K
karlman
Not sure if this is a SQL question or ASP.Net control question.
Probably can do it either way I imagine.
I have a simple page that uses a SqlDataSource, DropDownList, and a
GridView. I have the DropDownList post back and is a ControlParameter
for the SqlDataSource. It works great when selecting individual items
in the DropDownList but I want to also be able to query for all in the
list.
I add an extra ListItem into the DropDownList in the Page_Load event
but I am not sure what to put for value.
Example:
SELECT * FROM [Company] WHERE Company_ID = @CompanyID
@CompanyID is a control parameter for the DropDownList
What value can I set for the 'ALL' list item so it would return all
records and basically ignore the WHERE clause.
One idea I may try is to have another SqlDataSource that does not have
the where clause and change the GridView datasource on Page_Load if it
is set to 'ALL'...
Thanks
Karl
Probably can do it either way I imagine.
I have a simple page that uses a SqlDataSource, DropDownList, and a
GridView. I have the DropDownList post back and is a ControlParameter
for the SqlDataSource. It works great when selecting individual items
in the DropDownList but I want to also be able to query for all in the
list.
I add an extra ListItem into the DropDownList in the Page_Load event
but I am not sure what to put for value.
Example:
SELECT * FROM [Company] WHERE Company_ID = @CompanyID
@CompanyID is a control parameter for the DropDownList
What value can I set for the 'ALL' list item so it would return all
records and basically ignore the WHERE clause.
One idea I may try is to have another SqlDataSource that does not have
the where clause and change the GridView datasource on Page_Load if it
is set to 'ALL'...
Thanks
Karl