ViewState Value as Parameter for SQLDataSource

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Is it possible to use a ViewState Value as a Parameter for a
SQLDataSource? Looking at the options available as a Parameter
Source...it looks like no. But I'm being told that you can.

Comments/instructions?

Thanks
 
Is it possible to use a ViewState Value as a Parameter for a
SQLDataSource?  Looking at the options available as a Parameter
Source...it looks like no.  But I'm being told that you can.

Comments/instructions?

Thanks

Dave, you can do this from the code behind. For example, if you need
on select - use SqlDataSource.Selecting Event

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.selecting.aspx

Example:

protected void SqlDataSource1_Selecting(object sender,
SqlDataSourceSelectingEventArgs e)
{
e.Command.Parameters["@OrderID"].Value = ViewState["OrderID"];
}
 
Back
Top