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);
       }

  • 相关阅读:
    CSS 背景
    CSS padding 属性
    CSS border 属性和 border-collapse 属性
    CSS margin 属性
    IEnumerable<T> 接口和GetEnumerator 详解
    discuz! X3.4特殊字符乱码解决方案
    Discuz通过修改文章标题更好的实现SEO的方法
    关于Discuz x3.3页面空白解决方法
    discuz x3.3标题的最少字数限制设置方法
    discuz网站前端代码优化思路
  • 原文地址:https://www.cnblogs.com/amanda/p/312251.html
Copyright © 2011-2022 走看看