G
Guest
I have a TextBox used to enter a search value and a DropDownList used to
select which field should be searched on. I need to load a GridView with the
search results.
I have setup multiple select stored procedures and need to set the
SqlDataSource to use the required stored procedure and pass the value in the
TextBox to search with.
The following code sets up the SelectParameters for the SqlDataSource:
RegistrantsSqlDataSource.SelectParameters.Clear();
switch(selectionChoice){ // from DropDownList
case "Name":
Session["SelectCommand"] = "GetRegListbyName";
RegistrantsSqlDataSource.SelectParameters.Add( "Name",
TypeCode.String.ToString());
break;
case "Phone":
Session["SelectCommand"] = "GetRegListbyPhone";
RegistrantsSqlDataSource.SelectParameters.Add( "Phone",
TypeCode.String.ToString());
break;
etc...
I don't know how to pass the search value from the TextBox to the
SqlDataSource which the GridView is bound to.
Any suggestions would be appreciated, I'm going crosseyed looking at this.
select which field should be searched on. I need to load a GridView with the
search results.
I have setup multiple select stored procedures and need to set the
SqlDataSource to use the required stored procedure and pass the value in the
TextBox to search with.
The following code sets up the SelectParameters for the SqlDataSource:
RegistrantsSqlDataSource.SelectParameters.Clear();
switch(selectionChoice){ // from DropDownList
case "Name":
Session["SelectCommand"] = "GetRegListbyName";
RegistrantsSqlDataSource.SelectParameters.Add( "Name",
TypeCode.String.ToString());
break;
case "Phone":
Session["SelectCommand"] = "GetRegListbyPhone";
RegistrantsSqlDataSource.SelectParameters.Add( "Phone",
TypeCode.String.ToString());
break;
etc...
I don't know how to pass the search value from the TextBox to the
SqlDataSource which the GridView is bound to.
Any suggestions would be appreciated, I'm going crosseyed looking at this.