PC Review


Reply
Thread Tools Rate Thread

Accessing a control's properties from a user control

 
 
RSH
Guest
Posts: n/a
 
      18th Dec 2006
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



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing user control properties David Microsoft ASP .NET 0 12th Apr 2007 08:54 AM
Accessing Objects properties in User Control tshad Microsoft ASP .NET 0 3rd Aug 2006 07:24 PM
Accessing Datagrid properties within a user control from the outside Craig G Microsoft ASP .NET 3 30th Nov 2004 03:51 PM
accessing the readonly properties of a listmenu with a user control? Moe Sizlak Microsoft ASP .NET 4 17th Jul 2004 07:01 PM
Accessing .NET user control properties from JavaScript Chris Watson Microsoft VB .NET 0 13th Mar 2004 02:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:52 PM.