<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      atlas學習系列之二(AutoCompleteExtender篇)

      上一篇:atlas學習系列一(簡單體驗)
      原 來做asp.net的時候,有些表單是帶有參照類型的,比如城市的省份城市的錄入,或者員工姓名的錄入,以前的做法是走了兩個極端,一種是用戶在 TextBox中輸入,另一種是在DropDownList中進行選擇。第一種用戶需要記住錄入的全部內容,輸入效率才高,第二種無需提前知道錄入內容, 但是當供選擇的記錄過多的時候,選擇起來也比較麻煩。那么一種智能式選擇是一種折中的做法,我們原來是設置字典參照,然后在字典中選擇。現在有了 Atlas,這種事情實現起來就簡單多了。atlas的AutoCompleteProperties就可以滿足這方面的要求。它可以通過設置 TargetControlID來控制某個控件,并且需要提供一個Web Services的路徑和Web Services的方法。
      AutoCompleteProperties的屬性包括
      屬性名稱 屬性描述 備注
      TargetControlID 指定要控制的控件的ID 一般為TextBox的ID
      ServicePath 處理智能選擇列表的Web Services路徑
      ServiceMethod 處理智能選擇列表的網絡服務服務 該方法一般包含兩個參數(string prefixText, int count)
      Enabled 是否可用
      MinimumPrefixLength 最小前綴的長度大小 當輸入長度達到最小的時候,便提供智能選擇
      下面是一個Demo:
      按照上篇文章介紹,創建一個Atlas網站,然后再一個頁面中添加如下代碼:
       1<div>
       2    <asp:Panel ID="Panel1" runat="server" Height="125px" Width="125px">
       3    </asp:Panel>
       4    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:DropDownList ID="DropDownList2"
       5        runat="server">
       6    </asp:DropDownList>
       7    <atlas:AutoCompleteExtender ID="AutoCompleteExetender1" runat="server"  DropDownPanelID="Panel1">
       8    <atlas:AutoCompleteProperties  TargetControlID="TextBox1" Enabled="true" ServicePath="WebService.asmx" ServiceMethod="GetWordList"  MinimumPrefixLength="1" />
       9    </atlas:AutoCompleteExtender>
      10    </div>

      下面是處理智能選擇的網絡服務:
       1using System;
       2using System.Web;
       3using System.Collections;
       4using System.Web.Services;
       5using System.Web.Services.Protocols;
       6using System.IO;
       7
       8
       9/// <summary>
      10/// WebService 的摘要說明
      11/// </summary>

      12[WebService(Namespace = "http://tempuri.org/")]
      13[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
      14public class WebService : System.Web.Services.WebService {
      15
      16    public WebService () {
      17
      18        //如果使用設計的組件,請取消注釋以下行 
      19        //InitializeComponent(); 
      20    }

      21    public  string[] AutoCompleteWordList = null;
      22    [WebMethod]
      23    public string[] GetWordList(string prefixText, int count)
      24    {
      25        if (AutoCompleteWordList == null)
      26        {
      27            string[] tempList = File.ReadAllLines(Server.MapPath("~/App_Data/Words.txt"),System.Text.Encoding.Default);
      28            Array.Sort(tempList, new CaseInsensitiveComparer());
      29            AutoCompleteWordList = tempList;
      30        }

      31        int index = Array.BinarySearch(AutoCompleteWordList,prefixText,new CaseInsensitiveComparer());
      32        if(index<0)
      33        {
      34            index=~index;
      35        }

      36        int matchedCount = 0;
      37        for (matchedCount = 0; matchedCount < count&&matchedCount+index<AutoCompleteWordList.Length; matchedCount++)
      38        {
      39            if (!AutoCompleteWordList[matchedCount + index].StartsWith(prefixText,StringComparison.CurrentCultureIgnoreCase))
      40            {
      41                break;
      42            }

      43        }

      44        string[] returnValue = new string[matchedCount];
      45        if (matchedCount > 0)
      46        {
      47            Array.Copy(AutoCompleteWordList,index, returnValue,0, matchedCount);
      48        }

      49        return returnValue;
      50    }

      51
      52}

      53
      54
      如果在app_data中的txt文件wors.txt。
      此時,運行效果如下:

      這 個控件雖然好用易用,但是我思考卻不應該濫用。比如在一個很多人并發填寫表單的時候,這樣每寫幾個字就調用一下Web Services,每次取回來的東西也不會太大,這對于網絡服務來說,連接占用的時間過多,這嚴重偏離了網絡服務大塊頭設計的原則。因此應用也要看下環 境。
      上一篇:atlas學習系列一(簡單體驗)
      posted @ 2006-08-20 21:58  Robin Zhang  閱讀(3954)  評論(13)    收藏  舉報
      主站蜘蛛池模板: 91国内精品久久精品一本| 夜夜添狠狠添高潮出水| 色偷偷亚洲女人天堂观看| 亚洲欧美人成网站在线观看看| 一二三四区无产乱码1000集| 国产精品男女爽免费视频| 亚洲欧洲一区二区三区久久| 国产精品久久久久久影视| 67194熟妇在线观看线路| 亚洲精品综合久中文字幕| 国产激情精品一区二区三区| 亚洲AV蜜桃永久无码精品| 国产仑乱无码内谢| 亚洲综合av永久无码精品一区二区| 欧洲中文字幕一区二区| 久久天堂综合亚洲伊人HD妓女| 美女又黄又免费的视频| 亚洲天堂一区二区三区三州| 亚洲第一尤物视频在线观看导航| 色婷婷日日躁夜夜躁| 日韩人妻少妇一区二区三区| 亚洲av日韩在线资源| 国产精品久久无码一区| 少妇被粗大的猛烈进出| 亚洲精品毛片一区二区 | 成av免费大片黄在线观看| 国产精品久久久久鬼色| 亚洲愉拍一区二区三区| 亚洲色欲色欲大片www无码| 日韩精品久久不卡中文字幕| 人妻丝袜无码专区视频网站| 欧美色综合天天久久综合精品| 内射中出无码护士在线| 国产精品久久久久鬼色| 日本免费精品| 国产精品午夜福利免费看| 欧美性猛交xxxx乱大交丰满| 日韩人妻系列无码专区| 成人深夜节目在线观看| 国产稚嫩高中生呻吟激情在线视频| 97久久精品无码一区二区|