ヘッダー列 [Carrier] の 1 つにフィルターを作成したいと思います。作成した gridview のコードは次のとおりです。
インデックス.aspx:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="cr_OnSelectedIndexChanged"
DataSourceID="SqlDataSource1" DataTextField="CARRIER" DataValueField="CARRIER">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MybaseConnectionString %>"
SelectCommand="SELECT DISTINCT [CARRIER] FROM [TABLE]">
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" Height="150px" Width="284px">
</asp:GridView>
インデックス.aspx.vb
Inherits System.Web.UI.Page
Dim cx As New SqlConnection("Data Source=.\SQLEXPRESS;database=Mybase;Integrated Security=True;")
Dim cmd As New SqlCommand
Dim da As New SqlDataAdapter
Dim dt As New DataTable
Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
cmd.Connection = cx
cmd.CommandText = "select cl1, Carrier, cl2, cl3 from table"
da = New SqlDataAdapter(cmd)
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
End Sub
Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
End Sub
誰でも助けてください!ありがとうございました..