473,406 Members | 2,713 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,406 software developers and data experts.

Changing attributes inside a User Control

I have a User control that has some asp:textboxes and asp:labels in it where
I want to change the visibility and forecolor of these controls.

Right now I am getting and setting the .net controls using properties:
***************************************
Public Property FullName AS String
Get
Return objFullName.Text
End Get
Set
objFullName.Text = Value
End Set
End Property

Public Property Address1 AS String
Get
Return objAddress1.Text
End Get
Set
objAddress1.Text = Value
End Set
End Property

Public Property City AS String
Get
Return objContactCity.Text
End Get
Set
objCity.Text = Value
End Set
End Property

***************************************

But I can't use these properties to change other attributes. I could set up
other properties to do this but that would require setting up a lot of
properties something like:
************************************************** ***
Public Property FullNameColor As Color
Get
Return FullName.ForeColor
End Get
Set
lblMessage.ForeColor = value
End Set
End Property
************************************************** ***

Is this the best way to handle this?

Thanks,

Tom
Aug 15 '07 #1
1 1356
Hi Tom,
yes you have to create public properties to access your control's
attributes. If you need to change a lot of settings for each child control
you can think about creating public properties which will return reference to
these controls or definitely leave ASP.NET 2.0 code behind model and swap to
ASP.NET 1.1 model where you have to declare controls in code behind find at
your own and you can choose if they will be protected or public.

Regards,
Ladislav

"tshad" wrote:
I have a User control that has some asp:textboxes and asp:labels in it where
I want to change the visibility and forecolor of these controls.

Right now I am getting and setting the .net controls using properties:
***************************************
Public Property FullName AS String
Get
Return objFullName.Text
End Get
Set
objFullName.Text = Value
End Set
End Property

Public Property Address1 AS String
Get
Return objAddress1.Text
End Get
Set
objAddress1.Text = Value
End Set
End Property

Public Property City AS String
Get
Return objContactCity.Text
End Get
Set
objCity.Text = Value
End Set
End Property

***************************************

But I can't use these properties to change other attributes. I could set up
other properties to do this but that would require setting up a lot of
properties something like:
************************************************** ***
Public Property FullNameColor As Color
Get
Return FullName.ForeColor
End Get
Set
lblMessage.ForeColor = value
End Set
End Property
************************************************** ***

Is this the best way to handle this?

Thanks,

Tom
Aug 17 '07 #2

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

Similar topics

2
by: Jody Burgess | last post by:
Hi; I am writing my first python program and would like to know how to change stdout to refer to my default printer or any other printer on my network. The other question is, Is there an API set...
3
by: Andy Dingley | last post by:
We've all seen this structure many times: <ul> <li><a href="..." >Click here</a></li> <li><a href="..." >Click here</a></li> </ul> Now it's obvious good practice to have sensible link texts,...
2
by: Terry | last post by:
I'm trying to change styles sheets on a per user basis. I was able to do this on the client using DOM, but how can I do this using the code behind page in the Load Page sub? I have a place that I...
3
by: qwerty | last post by:
I´m new to ASP.Net. My workmate has some experience with it. He claimed that in ASP.Net working with frames is much simpler than it was ASP. I asked explanation but he couldn't give me such. (a...
0
by: Luis Esteban Valencia | last post by:
Hello. I have a datagrid with one row. I have a button that adds a new row. I am trying to implement that when the user selects one product it must change the price on the quantity column. Anyway...
7
by: Luis Mendes | last post by:
Hello, I've a application in VB.NET that uses a connection to a Access data base stored in my Hard Drive. How can I change the location of the database (To a network) and change the conection...
3
by: dcassar | last post by:
I am working on a complex server control that dynamically creates an HtmlInputHidden control that stores its value. As far as the postback process is concerned, this hidden input acts as the...
4
by: Jon Slaughter | last post by:
Is there any method to temporarily disable focus changing?(I assume only method is tab or mouse?) This problem has been tieing me up for a while and nothing seems to work. The only thing that I...
10
by: lpinho | last post by:
Hi all, I have a class (named for the example myObject) that can be of several types (int, string, float, etc), instead of using a object to define it's type I used a generic. public class...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.