Usercontrol enable property

Discussion in 'ASP .Net Building Controls' started by greatdane, Mar 22, 2006.

  1. greatdane

    greatdane Guest

    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
    textbox from my .aspx page?
     
    greatdane, Mar 22, 2006
    #1
    1. Advertising

  2. 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


    "greatdane" <> wrote in message
    news:...
    >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
    > textbox from my .aspx page?
     
    Steve C. Orr [MVP, MCSD], Mar 22, 2006
    #2
    1. Advertising

  3. greatdane

    greatdane Guest

    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))...
    "Steve C. Orr [MVP, MCSD]" wrote:

    > 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
    >
    >
    > "greatdane" <> wrote in message
    > news:...
    > >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
    > > textbox from my .aspx page?

    >
    >
    >
     
    greatdane, Mar 23, 2006
    #3
  4. What is the error you are getting?


    "greatdane" <> wrote in message
    news:...
    > 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))...
    > "Steve C. Orr [MVP, MCSD]" wrote:
    >
    >> 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
    >>
    >>
    >> "greatdane" <> wrote in message
    >> news:...
    >> >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
    >> > textbox from my .aspx page?

    >>
    >>
    >>
     
    Steve C. Orr [MVP, MCSD], Mar 23, 2006
    #4
  5. greatdane

    greatdane Guest

    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

    "Steve C. Orr [MVP, MCSD]" wrote:

    > What is the error you are getting?
    >
    >
    > "greatdane" <> wrote in message
    > news:...
    > > 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))...
    > > "Steve C. Orr [MVP, MCSD]" wrote:
    > >
    > >> 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
    > >>
    > >>
    > >> "greatdane" <> wrote in message
    > >> news:...
    > >> >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
    > >> > textbox from my .aspx page?
    > >>
    > >>
    > >>

    >
    >
    > .
    >
     
    greatdane, Mar 24, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrés Giraldo
    Replies:
    2
    Views:
    405
    Andrés Giraldo
    Dec 15, 2003
  2. =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=

    Enable property of a Panel not functioning

    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=, Feb 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    368
    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=
    Feb 7, 2005
  3. vikram
    Replies:
    1
    Views:
    535
    William F. Robertson, Jr.
    Apr 13, 2005
  4. Fabiano
    Replies:
    2
    Views:
    652
    =?Utf-8?B?c3Jpbmk=?=
    Jun 3, 2005
  5. Patrick
    Replies:
    1
    Views:
    713
Loading...

Share This Page