在ASP.NET中使用AJAX即時搜尋功能控制項--RealTimeSearchMonitor

來源:互聯網
上載者:User

Web Client Software Factory v2.0包含了一個RealTimeSearchMonitor控制項 提供即時搜尋功能 來協助你在ASP.NET中使用ASP.NET AJAX 局部更新網頁。

此文章協助你 如何在ASP.NET 中使用 RealTimeSearchMonitor控制項,資料來自Northwind資料庫的Customers表,資料訪問是用企業庫寫的,當然你也可以使用別的任何方式返回資料來源,,不過不用企業庫寫個SQL語句還真是夠複雜!!!

先決條件

使用realtimesearchmonitor ,必須是在一個網站或Web應用程式項目中用,並要符合下列條件:

配置為目標的Microsoft。NET Framework 3.5。

表單必須至少有一個搜尋輸入控制項,如:TextBox控制項。

搜尋結果必須包含ASP.NET AJAX UpdatePanel控制項中。

1.下載Web Client Software Factory v2.0, RealTimeSearchMonitor原始碼路徑是:Web Client Software Factory 2.0\Samples\RealTimeSearch\RealTimeSearch,編譯通過,引用realtimesearch.dll到網站就行了。

2.拖放控制項到頁面

需要設定AssociatedUpdatePanelID屬性指向UpdatePanel的ID,

需要設定ControlsToMonitor(集合)中的屬性TargetID指向輸入控制項,eventname事件是可選的,如果沒有設定該屬性預設由TargetID的控制項事件更新。

<form id="form1" runat="server">
   <asp:ScriptManager ID="ScriptManager1" runat="server">
   </asp:ScriptManager>
   <div>
     <asp:TextBox ID="TextBox1" OnTextChanged="TextBox1_TextChanged" runat="server" />
     <rts:RealTimeSearchMonitor ID="CustomerRealTimeSearchMonitor" runat="server" Interval="700"
       AssociatedUpdatePanelID="UpdatePanel">
       <ControlsToMonitor>
         <rts:ControlMonitorParameter TargetID="TextBox1" />
       </ControlsToMonitor>
     </rts:RealTimeSearchMonitor>
     <asp:UpdatePanel ID="UpdatePanel" runat="server" UpdateMode="Conditional">
       <ContentTemplate>
         <hr />
         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="CustomerID"
           PageSize="10" AllowPaging="True" Width="690px" OnPageIndexChanging="GridView1_PageIndexChanging">
           <Columns>
             <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID" />
             <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName" />
             <asp:BoundField DataField="ContactName" HeaderText="ContactName" SortExpression="ContactName" />
             <asp:BoundField DataField="ContactTitle" HeaderText="ContactTitle" SortExpression="ContactTitle" />
             <asp:BoundField DataField="City" HeaderText="Zip" SortExpression="City" />
             <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
           </Columns>
         </asp:GridView>
       </ContentTemplate>
     </asp:UpdatePanel>
   </div>
   </form>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.