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

Accessing Objects properties in User Control

I have a User Control with 4 Textboxes.

I want to be able to access the properties (.text, .visible, .enable etc)
directly from outside the Controls as the normal properties (.text, .visible
etc).

For example: at the moment I need to create a new property for each TextBox
since I can't figure out how to set up "text" as a property.

*********************************************
<Script Runat="Server">

Public Property Street As String
Get
Return txtStreet.Text
End Get
Set
txtStreet.Text = Value
End Set
End Property

Public Property City As String
Get
Return txtCity.Text
End Get
Set
txtCity.Text = Value
End Set
End Property

Public Property State As String
Get
Return txtState.Text
End Get
Set
txtState.Text = Value
End Set
End Property

Public Property ZIP As String
Get
Return txtZIP.Text
End Get
Set
txtZIP.Text = Value
End Set
End Property

</Script>

<p>Street Address:
<br>
<asp:TextBox
ID="txtStreet"
Runat="Server" />

<p>City:
<br>
<asp:TextBox
ID="txtCity"
Runat="Server" />

<p>State:
<br>
<asp:TextBox
ID="txtState"
Runat="Server" />

<p>ZIP:
<br>
<asp:TextBox
ID="txtZIP"
Runat="Server" />
*********************************************
In my .aspx file I may have the following:

<SuperCompany:Address
ID="ctlBillingAddress"
Runat="Server" />

I need to do:

ctlBillingAddress.Street = "xxx"

I understand that I can't do ctlBillingAddress.text as there would be no way
to know which textbox you are referring to.

I am curious if there is a better way to set this up with multiple objects
in my controls?

Thanks,

Tom
Aug 3 '06 #1
0 922

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

Similar topics

3
by: Craig G | last post by:
i have a user control which is basically a datagrid, which has add/edit/delete buttons on the grid is there anyway of accessing the actual datagrid from the form itself? basically i want to...
0
by: Joergen Bech | last post by:
Fairly new to ASP.NET 1.1. Getting the error below when running application on a web server outside of my control, but only the first time I run it: 1. After a long period of inactivity (or...
3
by: tshad | last post by:
I am trying to put together a user control (.ascx). Can you access an outside control from it? My control: login2.ascx ****************************************************************...
4
by: tshad | last post by:
Is there a way for a User Control to access an object (such as label or textbox) on the .aspx page that calls it? For example: x.aspx ************************************** .... Sub...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...
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,...

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.