Groups | Blog | Home
all groups > asp.net building controls > march 2006 >

asp.net building controls : Usercontrol enable property


greatdane
3/22/2006 1:01:26 PM
I have a usercontrol with a textbox.
I displayed the control programmatically on my .aspx

How could I manipulate the 'enable property' and/or bordercolor of the ucl
Steve C. Orr [MVP, MCSD]
3/22/2006 1:33:26 PM
The simplest way is to declare the textbox as public (instead of the default
of private).
You may be able to do this by setting its Modifiers property.

Here are more details about best practices on this subject:
http://SteveOrr.net/faq/PassDataToUserControl.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


[quoted text, click to view]

greatdane
3/23/2006 12:49:38 PM
This helped me... Thanks
In addition I am trying to create on my page an array of 4 strings
containing the name of 4 textboxes from my control.
Dim a(4) as string
a(0) = "txtCrownofroad"
a(1) = "txtcntyfld"
a(2) = "txtreviewzone"
a(3) = "txtreviewbfe"
Dim x As Integer

For x = 0 To a.Length
CType(ctlFReview_entry.FindControl(a(x)), TextBox).ReadOnly =
False
CType(ctlFReview_entry.FindControl(a(x)), TextBox).BorderColor =
Color.SteelBlue
Next
I am getting an error because it is not reading '.FindControl(a(x))...
[quoted text, click to view]
Steve C. Orr [MVP, MCSD]
3/23/2006 1:33:28 PM
What is the error you are getting?


[quoted text, click to view]

greatdane
3/24/2006 6:27:01 AM
I did not write the error down; however, reading a little further from the
article the you referenced before, I decided to implented the code as follow:
It is a better approach. Thanks for your help!!
For Each Panel2_Control As Control In Panel2.Controls(0).Controls
If TypeOf Panel2_Control Is TextBox Then
CType(Panel2_Control, TextBox).ReadOnly = False
CType(Panel2_Control, TextBox).BorderColor = Color.SteelBlue
End If
Next

[quoted text, click to view]
AddThis Social Bookmark Button