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

  • 相关阅读:
    01:oracle sql developer配置
    删除eclipse或者MyEclipse的workspace记录
    c++特殊函数
    java类和对象的基础(笔记)
    java打印日历
    10_9 java笔记
    程序流程
    学习疑惑……
    位运算和逻辑运算
    多种类型的指针
  • 原文地址:https://www.cnblogs.com/amanda/p/312251.html
Copyright © 2011-2022 走看看