make (GridView with DropDownList using FilterExpression in SqlDataSource) work without reloading the page using JavaScript

249 views Asked by At

How can i make this (Filter GridView with DropDownList using FilterExpression in SqlDataSource) work without reloading the page using JavaScript ?

<asp:DropDownList ID="ddlCountries" runat="server" AutoPostBack="True" DataSourceID="DropDownDataSource"
    DataTextField="SC" DataValueField="SC" AppendDataBoundItems="True">
    <asp:ListItem Text="All " Value="" />
</asp:DropDownList>

<asp:SqlDataSource ID="DropDownDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:CountConnectionString %>"
    SelectCommand="SELECT [SC] FROM [CountTable]"></asp:SqlDataSource>

<asp:GridView ID="GridView1" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White"
    runat="server" AutoGenerateColumns="False" DataSourceID="GridDataSource" 
        DataKeyNames="ID">
    <Columns>
        <asp:BoundField DataField="ID" HeaderText="ID" ItemStyle-Width="150" 
            InsertVisible="False" ReadOnly="True" SortExpression="ID" />
        <asp:BoundField DataField="SC" HeaderText="SC" ItemStyle-Width="150" 
            SortExpression="SC" />
        <asp:BoundField DataField="Traffic" HeaderText="Traffic" 
            SortExpression="Traffic" />
    </Columns>

<HeaderStyle BackColor="#3AC0F2" ForeColor="White"></HeaderStyle>
</asp:GridView>

<asp:SqlDataSource ID="GridDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:CountConnectionString %>"
    SelectCommand="SELECT * FROM [CountTable]" FilterExpression="SC = '{0}'">
    <FilterParameters>
        <asp:ControlParameter Name="SC" ControlID="ddlCountries" PropertyName="SelectedValue" />
    </FilterParameters>
</asp:SqlDataSource>
0

There are 0 answers