占位符可以只读吗? [英] Can placeholder address as readonly?

查看:70
本文介绍了占位符可以只读吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我已经在网上和书籍中进行过搜索.我想使我的占位符与加载的用户控件一起禁用.

Hi, I already searched over the net and books. I want to make my placeholder disable together with the loaded user control. Is that possible to make my placeholder marked as readOnly o my usercontrol(.ascx) marked as readonly?

推荐答案

我的usercontrol(.ascx)是否可以将我的占位符标记为readonly或将usercontrol(.ascx)标记为readonly?标记为只读?
通过这种方式,我假设您希望将用户控件设为只读,因为您不希望对控件进行任何修改?为什么不像这样在用户控件上创建自己的Readonly属性?
my usercontrol(.ascx) marked as readonly?
By this I assume that you want to make your usercontrol readonly because you don''t want any modification on your controls? Why not create your own Readonly property on your user control, like this?
public bool ReadOnly
{
   get
   {
      return readOnly_var; //here you return the initial value of your property that is stored somewhere
   }
   set
   {
      TextBox1.ReadOnly = value;
      //etc... put the controls that you want to be readonly
   }
}



然后在页面上,您可以像这样设置属性.



And then on your page, you can set the property like this.

UserControl1.ReadOnly = true;


这篇关于占位符可以只读吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆