Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?
Posted

1 solution

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?
C#
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.
C#
UserControl1.ReadOnly = true;
 
Share this answer
 
Comments
Matt Jun 27-Jul-11 5:04am    
Hi Walter, I already saw this code a while ago. But I have too many controls and Objects(Textbox, CheckBox... etc) in each control. Is there any way to convert it during runtime. I mean all in one or little lines of codes.
BobJanova 27-Jul-11 7:31am    
You could use a control tree walking algorithm and set all controls to ReadOnly or not dynamically ... see the many WinForms questions on this issue, it should work for web as well.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900