Accessing a control's properties from a user control

Discussion in 'Microsoft VB .NET' started by RSH, Dec 18, 2006.

  1. RSH

    RSH Guest

    I have a situation where I have developed a user control that contains
    several ImageButtons with hardcoded values.

    In the codebehind I have a property that is setup to receive a string value
    from the parent page. The properties value is also the name of the control.
    So what I am trying to do, is when the property is set I want to use the
    string value to reference the appropriate imagebutton and change the
    imageurl property without having to do a large case statement.

    For example...this is one imagebutton in the ascx file:
    <asp:imagebutton id="CompanyProperty" style="LEFT: 35px; POSITION: relative;
    TOP: 7px" runat="server"
    ImageUrl="Images/companyProperty_Tab1.gif"></asp:imagebutton>


    In the control's codebehind I have the following property:
    Public Property ActiveTab() As String

    Get

    Return _ActiveTab

    End Get

    Set(ByVal Value As String)

    Dim iButton As New ImageButton

    iButton.ID = Value

    iButton.ImageUrl = "images/" & Value & ".gif"

    End Set

    End Property



    In the parent page's code I am setting the ActiveTab Property =
    "CompanyProperty"

    So what I am asking is how can I get at the CompanyProperty ImageButtutton's
    imageUrl property without having to do something like this:

    If Value="CompanyProperty" then

    end if



    Is there a way?

    Thanks so much!

    Ron
     
    RSH, Dec 18, 2006
    #1
    1. Advertisements

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. Chris Watson

    Accessing .NET user control properties from JavaScript

    Chris Watson, Mar 13, 2004, in forum: Microsoft VB .NET
    Replies:
    0
    Views:
    648
    Chris Watson
    Mar 13, 2004
  2. Robert Kemp

    Accessing controls that are attached to a tray control

    Robert Kemp, Jun 15, 2004, in forum: Microsoft VB .NET
    Replies:
    2
    Views:
    152
    Robert Kemp
    Jun 18, 2004
  3. squeaks

    accessing volume control properties

    squeaks, Oct 2, 2004, in forum: Microsoft VB .NET
    Replies:
    0
    Views:
    216
    squeaks
    Oct 2, 2004
  4. Guest
    Replies:
    0
    Views:
    533
    Guest
    Jun 8, 2006
  5. Dimsion
    Replies:
    9
    Views:
    302
    Ahmed
    Jun 17, 2006
Loading...

Share This Page