代码改变世界

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

  Clingingboy  阅读(901)  评论(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}
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示