I have a website that shows a dropdownlist and a gridview, the gridview is filtered by the value of the dropdownlist when i show the site in debugging mode the gridview shows the right data but when i change the value of the list nothing happens?
but i have some code in the event of selectedindexchanged of the dropdownlist.
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DropDownList1.SelectedIndexChanged
GridView1.DataBind()
System.Diagnostics.Debug.WriteLine("after refresh")
End Sub
End Class
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title><style type="text/css">
#form1
{
width: 770px;
margin-right: 385px;
margin-bottom: 60px;
}</style></head><body style="width: 1473px; height: 642px"><form id="form1" runat="server"><asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2" DataTextField="Top_Rated" DataValueField="Top_Rated" Height="38px" Width="296px"></asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:New Movie DatabaseConnectionString %>" SelectCommand="SELECT [Top Rated] AS Top_Rated FROM [TopRatedGenreQuery] ORDER BY [Top Rated]"></asp:SqlDataSource><asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" style="margin-right: 7px" Width="697px"><Columns><asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /><asp:BoundField DataField="Personal Rating" HeaderText="Personal Rating" SortExpression="Personal Rating" /><asp:BoundField DataField="IMDB Rating" HeaderText="IMDB Rating" SortExpression="IMDB Rating" /></Columns></asp:GridView><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:New Movie DatabaseConnectionString %>" SelectCommand="ShowTopRated" SelectCommandType="StoredProcedure"><SelectParameters><asp:ControlParameter ControlID="DropDownList1" DefaultValue="Action" Name="Genre" PropertyName="SelectedValue" Type="String" /></SelectParameters></asp:SqlDataSource></form></body></html>