在ASP.NET中过滤转发器

时间:2015-04-15 15:54:27

标签: c# asp.net ajax repeater

我是ASP.NET和C#的新手,我在使用AJAX在Repeater Control中过滤我的SQL数据时遇到了困难。

我在我的页面上显示了SQL数据,但我需要找到一种使用AJAX过滤数据的方法。我不确定是否需要在我的.cs文件中添加代码或者可以通过JavaScript / JQuery进行更新。

Repeater的代码如下:

    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" OnItemCommand="Repeater1_ItemCommand">
        <ItemTemplate>
           <div class="PhysicianDetails">
                    <span><%#Eval("LastName")%>,</span>
                    <span><%#Eval("FirstName")%></span>
                    <p><%#Eval("Language")%></p>
                <asp:Button ID="Button2" runat="server" Text="View Profile" CommandName="ViewProfile" CommandArgument='<%#Eval("ContactID")%>' />
            </div>
        </ItemTemplate>
    </asp:Repeater>

我希望在Repeater Control中过滤数据的输入字段和DropDownList的代码。

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>

            <div id="sidebar">
                <h3>Refine Your Search</h3>
                <p>Provider First Name:</p>
                <input type="text" runat="server" name="name" value=" " placeholder="Search by First Name" />
                <asp:Button ID="Button1" runat="server" Text="GO" />

                <p>Provider Last Name:</p>
                <input type="text" name="name" value=" " placeholder="Search by Last Name" />
                <%--Last Name<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>--%>
                <asp:Button ID="Button2" runat="server" Text="GO" />

                <p>Search by Language:</p>
                <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2" DataTextField="Languages" DataValueField="Languages"></asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:DB %>" SelectCommand="Select DISTINCT Language From Languages"></asp:SqlDataSource>
                <asp:Button ID="Button3" runat="server" Text="GO" />
            </div>

有什么建议吗?谢谢!

0 个答案:

没有答案