I need to fill in the "SelectParameters" dynamically , but all I found on Google , was using fixed parameters.
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="XX"
OnSelecting="SqlDataSource2_Selecting" SelectCommand="">
<SelectParameters>
</SelectParameters>
</asp:SqlDataSource>
Is there any solutions ?
I also tried to use the "OnSelecting" event , but I can't assign value to parameters that are not present.
protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
string[] queryFields = new string[] { ... }; // some dynamic field depends on different table
foreach (string s in queryFields)
{
e.Command.Parameters["@" + s].Value = "filter";
}
}