Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to make all my page controls read only in one go
Message
From
25/03/2004 10:48:23
Keith Payne
Technical Marketing Solutions
Florida, United States
 
 
To
25/03/2004 10:17:35
General information
Forum:
ASP.NET
Category:
Web forms
Miscellaneous
Thread ID:
00889604
Message ID:
00889623
Views:
25
Mark,

You can use reflection to determine if the control has a ReadOnly/Enabled property. Have a look at the System.Reflection namespace or GetProperty(ies?) method in the help file. I'm sorry that I can't be more specific, I don't have access to VS.NET at the moment.

>I have a VB Data Entry Web form
>
>I need to switch most of the controls on this to read only under program control.
>
>I can write code set each controls enabled property to false one at a time, but this seems a PITA to do for every form I write.
>
>I need to be able to say make everything disabled apart from .........
>
>I started with the following and then got stuck because the enabled property is not available for all objects.
>
>I assume I have to make my code more specific using gettype, but I have no idea how to do this and I can find no examples on the web.
>
>Can someone get me started
>Many thanks
>
>
>
>
>                Dim item As System.Web.UI.Control
>
>
>                With Me.Controls
>
>                    For Each item In Me.Controls
>
>                        ' At this point I discovered there was no enable property I could set
>
>                        Dim mytype As String = item.GetType.ToString
>
>
>                    Next
>
>
>
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform