Wednesday, August 11, 2010

How do I populate a GridView from a selection in a drop down list?

I am looking to build one page with unassigned tech tickets in the GridView, then from a drop down list one of our techs can select their name which is populate from a table in SQL to specify the where clause to their username.How do I populate a GridView from a selection in a drop down list?
If you're using ASP.NET 2.0, you can resort to SqlDataSource to solve your problem.





Something like this:


%26lt;asp:SqlDataSource ID=';ID'; runat=';server'; ConnectionString=';connectionString'; ProviderName=';providerName'; SelectCommand= SELECT [ProductID], [ProductName], [UnitPrice] FROM [Products] WHERE ([CategoryID] = ?)';%26gt;


%26lt;SelectParameters%26gt;


%26lt;asp:ControlParameter Type=';Int32'; Name=';CategoryID'; ControlID=';categoriesDDL'; PropertyName=';SelectedValue'; /%26gt;


%26lt;/SelectParameters%26gt;


%26lt;/asp:SqlDataSource%26gt;





Check this out:


http://quickstarts.asp.net/QuickStartv20鈥?/a>


Hope this helps

No comments:

Post a Comment