Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to retrieve the value of an SqlDataSource SelectParameter. I have looked at the properties available in the 'sqlSataSourceName.SelectParameters("ParameterName").' property list, but none of them relate to retrieving the value... you can get the DefaultValue, but not the value.

I suppose it's a possibility that the value may be stored somewhere in the 'GridViewName.DataSource' object that this sqldatasource is populating...

Is there any way of getting the value?
Posted
Comments
zkumoj 24-Mar-14 13:15pm    
does not work i get

{"Index 0 is either negative or above rows count."}

any other ideas
Maciej Los 24-Mar-14 14:49pm    
Not clear! Please, be more specific and provide more details. When and why do you want to read values from SQLParametersCollection? What have you done till now? Where are you stuck?

Hi,


You can use a dataview to read values in your sqldatasource.

DataView testView = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
string test = testView[0]["Your Column Name"].ToString();


I hope it helps
 
Share this answer
 
Have a look here: Using Parameters with the SqlDataSource Control[^]. On the bottom of related page, you'll find an example.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900