dc900
asked on
Populating GridView from a dropdown list.
I have a GridView where I configured the SmartTag connection and SQL statement to use the value specified in the dropdown list control. The query test worked correctly. I added a data bind for the grid when the value in the dropdown changes, but this does not work and my grid does not appear. Any thoughts on what might be wrong?
Protected Sub ddlSite_SelectedIndexChang ed(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlSite.SelectedIndexChang ed
gvSiteDocuments.DataBind()
End Sub
I am looking for some guidance or sample code that will help me complete this. Any information will
be greatly appreciated. Thanks. DC900
My Environment
Windows XP Pro
Visual Studio 2005 & VB.NET
SQL Server 2000
Protected Sub ddlSite_SelectedIndexChang
gvSiteDocuments.DataBind()
End Sub
I am looking for some guidance or sample code that will help me complete this. Any information will
be greatly appreciated. Thanks. DC900
My Environment
Windows XP Pro
Visual Studio 2005 & VB.NET
SQL Server 2000
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or... you can go to the ASP.NET Quickstart Tutorial Site and you'll find an example for doing just what you're asking.
http://www.asp.net/QuickStart/aspnet/
look for the example called "VB Filter By DropDownList". You'll find it under "Performing Data Access > Filtering Data"
http://www.asp.net/QuickStart/aspnet/
look for the example called "VB Filter By DropDownList". You'll find it under "Performing Data Access > Filtering Data"
Me.GridView1.DataSource = NewDataSource(New Query based on selected drop down value)
Me.GridView1.DataBind()