代码改变世界

一个类控制不同种类控件的同时启用或停用

2006-07-19 10:24  Clingingboy  阅读(898)  评论(1编辑  收藏  举报
      先声明下,这个类是老外写的,非原创,但挺有用的。分享一下

1,枚举

 1using System;
 2
 3namespace Clingingboy
 4{
 5    /// <summary>
 6    /// 启用控件枚举
 7    /// </summary>

 8    public enum ControlName
 9    {
10        /// <summary>
11        /// Includes asp.net button, image button, link button, html button.
12        /// </summary>

13        Button,
14        /// <summary>
15        /// Includes asp.net text box, html input text, html text area server controls.
16        /// </summary>

17        TextBox,
18        /// <summary>
19        /// Includes asp.net check box and html input check box.
20        /// </summary>

21        CheckBox,
22        /// <summary>
23        ///    Includes asp.net drop down list, list box, html select.
24        /// </summary>

25        ListControl,
26        /// <summary>
27        /// Includes asp.net validators.
28        /// </summary>

29        Validator,
30        /// <summary>
31        /// All the controls that are defined in this enum.
32        /// </summary>

33        All
34    }

35}

36

2,最后一个方法无效,因为Control不存在此属性
  1using System;
  2using System.Text;
  3using System.Web;
  4using System.Web.UI;
  5using System.IO;
  6using System.Net;
  7using System.Text.RegularExpressions;
  8using System.Web.UI.WebControls;
  9using System.Web.UI.HtmlControls;
 10
 11
 12namespace Clingingboy
 13{
 14    /// <summary>
 15    /// 控件启用状态
 16    /// </summary>

 17    public class ControlEnabler
 18    {
 19
 20        Page Control Enabling / Disabling Utility
167    }

168}