473,394 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Accessing a control's properties from a user control

RSH
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

Dec 18 '06 #1
0 822

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Charles | last post by:
Hello, I am in ASP.NET using C#. I have a user control called "progHeader.ascx" that has a label control call "pageTitle". How do I call "pageTitle" from my asp page(Inventory.aspx), with the...
2
by: Jim Mace | last post by:
I have an ASP.net user control (userName) that is being dynamically loaded into a panel (pnlSearch) in another user control (userSearch). My question is, how do I access the form elements in...
3
by: qwerty | last post by:
I have two User controls in a page. Them ID-propertys are example UC1 and UC2. In code behind file they are declared: Public UC1 As UC1 Public UC1 As UC1 From the page I can call them with...
2
by: vs | last post by:
Hello, A quick question... How can I access the properties of controls that are on a user control from the page that contains the user control? I have a user control with two labels. I then...
2
by: Charlie | last post by:
Hi: When I drop one user control on to the design surface of another user control I can't seem to get a reference to it. Using the following in host control doesn't appear to work... protected...
2
by: DJ | last post by:
Hi, I have a user control that produces and maintains a student form for test enrollment. It contains all functionality such as adding, editing, suspending, etc., a student from a selected test...
2
by: MattB | last post by:
I have a user control that gets dynamically added to a page. It has a couple of validators that I programmatically set properties for. All of this works, but my problem is: When not in use, I make...
6
by: David Hearn | last post by:
I have a property in a user control that I am setting: Private strPageName as String Public Property PageName() as String Get Return strPageName End Get Set(byVal Value as String)...
0
by: dongarbage | last post by:
Hi there, I've created a user control to put in a web page. I'd like to add a windows media player control to the user control that I've created. But, for some reason, the user control does not...
1
by: =?Utf-8?B?Y2hha3Jpcw==?= | last post by:
Hi All, Iam developing a web application using VS 2005 asp.net 2.0 with C#. I have my base class in "App_Code" folder and i have another folder called "Users" where i have developed a user...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.