zoukankan      html  css  js  c++  java
  • 在自定义控件中实现AutoCompleteType

    NET Framework version 2.0新增加了一个property——AutoCompleteType。

    To assist with data entry, Microsoft Internet Explorer 5 and later and Netscape support a feature called AutoComplete. AutoComplete monitors a text box and creates a list of values entered by the user. When the user returns to the text box at a later time, the list is displayed. Instead of retyping a previously entered value, the user can simply select the value from this list. Use the AutoCompleteType property to control the behavior of the AutoComplete feature for a TextBox control. The System.Web.UI.WebControls.AutoCompleteType enumeration is used to represent the values that you can apply to the AutoCompleteType property.

    上面是MSDN的原文。

    在自定义控件中如何实现AutoCompleteType呢?如果控件继承自webcontrol,那么它将自带这个property。

    当页面运行起来,控件在showhistorylist的时候,首先去判断AutoCompleteType是否为None,如果是None,那么就根据control的ID来show history list;如果该属性不为None,则根据该type来show history list。

    这就要求我们在保存历史信息的时候必须分开处理这两种情况。下面是保存cookie的一段示范代码:

    if (this.AutoCompleteType != "None")
       {
        this.SetCookie(this.AutoCompleteType, this.Text);
       }
       else
       {
        this.SetCookie(this.ID, this.Text);
       }

  • 相关阅读:
    让文字在标签li的底部
    根据不同的浏览器对不同元素进行css调整
    根据ie浏览器不同的类别选择不同的css
    ASP流程控制语句
    asp动态生成google的sitemap地图的代码
    glusterfs 思维导图
    利用saltstack管理边缘计算节点
    ACK EDGE 实战
    /dev/shm 容器下调优
    MySQL DBA 001
  • 原文地址:https://www.cnblogs.com/amanda/p/312251.html
Copyright © 2011-2022 走看看