passing parameters to gridview

tcl4p

Well-known member
Joined
Feb 29, 2008
Messages
48
Programming Experience
1-3
I have a gridview that is set to a datasource which is linked to a stored procedure. That worked fine and in design view the columns returned showed up on the grid and I could set each column's properties. The question is how do pass parameters to the stored procedure via the datasource? That is to say I have to pass a start date and end date to the stored procedure, but can't find any way to do so. In asp.net I could set parameters as such:
Me.SqlDataSource1.SelectParameters("DeptID").DefaultValue = Session("DeptID")
but there is no such property as SeletParameters.

As a side note I first tried to bind the gridview to a datareader, which was returned from running the same stored procedure as above. The code seemed to work fine, but there was nothing on the gridview. Also if you set the datasource to the datareader i.e. you don't link the datasource in design view how do you set up the data columns?

Thanks
Tom
 

Latest posts

Back
Top