473,568 Members | 3,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:A ddress
ID="ctlBillingA ddress"
Runat="Server" />

I need to do:

ctlBillingAddre ss.Street = "xxx"

I understand that I can't do ctlBillingAddre ss.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 930

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

Similar topics

3
1638
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 set the add/edit/delete options visble/invisible on the datagrid depending on the users's role, but found that i cannot access the grid to do this. ...
0
2251
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 updating the code-behind dll) accessing any aspx page in the application causes the application to run for the first time. Some of the initialization...
3
1763
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 **************************************************************** <script runat="server"> Sub Page_Load(sender as Object, e as EventArgs)
4
1680
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 Page_Load(s as Object, e as EventArgs) LoadControl("x.ascx")
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7665
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.