- Posted by justin on March 8, 2007
I had a need to set some of the ObjectDataSource parameters for my select statement at runtime. Sometimes the parameters are set from a cookie, other times from a querystring and sometimes from a form field.
To set the parameters at runtime, you need to implement the Selecting Event for the ObjectDataSource and then use the InputParameter for the ObjectDataSourceSelectingEventArgs to set the value.
Example:
protected void ObjectDataSource1_Selecting(object sender,ObjectDataSourceSelectingEventArgs e)
{
e.InputParameters["MyParameterName"] = ParameterValue;
}