473,406 Members | 2,707 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.

find child control

i have a textbox control inside a custom server control that needs to be prefilled with content.

how do i find this child control ?
<ew:cp id="ccp2" TitleText="" runat="server">
<asp:TextBox id=TB1" runat="server" />
</ew:cp>
Dec 3 '06 #1
3 1522
Your best bet may be to expose the text property of the textbox instead. You
would do this as a property for the control such as:

public string TextBoxText
{
get
{
return TB1.Text;
}
set
{
TB1.Text = value;
}
}

I've found that this works nicer than trying to find controls since you
don't have to worry about testing for null values.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot comwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
>i have a textbox control inside a custom server control that needs to be
prefilled with content.

how do i find this child control ?
<ew:cp id="ccp2" TitleText="" runat="server">
<asp:TextBox id=TB1" runat="server" />
</ew:cp>

Dec 3 '06 #2
i have no way of using that type of coding.

what's the vb inline code equivalent of this ?
sub page_load()
public string TextBoxText
{
get
{
return TB1.Text;
}
set
{
TB1.Text = value;
}
}
End sub

"Mark Fitzpatrick" <ma******@fitzme.comwrote in message news:%2********************@TK2MSFTNGP06.phx.gbl.. .
Your best bet may be to expose the text property of the textbox instead. You would do this as a property for the control such as:

public string TextBoxText
{
get
{
return TB1.Text;
}
set
{
TB1.Text = value;
}
}

I've found that this works nicer than trying to find controls since you don't have to worry about testing for null values.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot comwrote in message news:%2******************@TK2MSFTNGP04.phx.gbl...
>>i have a textbox control inside a custom server control that needs to be prefilled with content.

how do i find this child control ?
<ew:cp id="ccp2" TitleText="" runat="server">
<asp:TextBox id=TB1" runat="server" />
</ew:cp>


Dec 3 '06 #3
Jon,
It's just a property definition. In VB it would be:

Public Property TextBoxText() As String
Get
Return TB1.Text
End Get
Protected Set(ByVal value As String)
TB1.Text = value
End Set
End Property

You define this in the user control. It's not to be placed within any other
function such as page_load. It's considered a function by itself. To set it,
you would use
sub page_load()
ccp2.TextBoxText = "some text"
End sub

within the page that contains the usercontrol it.
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot comwrote in message
news:uZ**************@TK2MSFTNGP05.phx.gbl...
>i have no way of using that type of coding.

what's the vb inline code equivalent of this ?
sub page_load()
>public string TextBoxText
{
get
{
return TB1.Text;
}
set
{
TB1.Text = value;
}
}
End sub

"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:%2********************@TK2MSFTNGP06.phx.gbl.. .
>Your best bet may be to expose the text property of the textbox instead.
You would do this as a property for the control such as:

public string TextBoxText
{
get
{
return TB1.Text;
}
set
{
TB1.Text = value;
}
}

I've found that this works nicer than trying to find controls since you
don't have to worry about testing for null values.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot comwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl. ..
>>>i have a textbox control inside a custom server control that needs to be
prefilled with content.

how do i find this child control ?
<ew:cp id="ccp2" TitleText="" runat="server">
<asp:TextBox id=TB1" runat="server" />
</ew:cp>



Dec 3 '06 #4

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

Similar topics

1
by: Tia Carr | last post by:
When I try to place a child control on top of a panel control, the mouse pointer remains as a pointer instead of changing to a cross. I tried both the ShowGrid on/off, doesn't make a difference.....
3
by: Arulraja | last post by:
Hello, I have created 2 custom server controls, The parent custom control contains multiple child custom controls. The Child control has a button on it. If I Click the button control, it...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
0
by: Bruin | last post by:
Hi All, I'm having a problem with MDI child forms when the reference to the MDI Parent is set in a Control library. (Sorry for the long post) I have an control library assembly which holds all...
0
by: Qwert | last post by:
Heya, I have a user control (inherits from listview control). I add a textbox control to it as a child control and give the child control the focus. All is well when I type text (keyboard input)...
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
1
by: shapper | last post by:
Hello, I have a custom control, MyCustomControl, with a property named Childs of type Generic.List(Of MyChildControl). I added a MyCustomControl to my page and added a few MyChildControls to...
2
by: Bob Johnson | last post by:
..NET 3.5: I have placed two controls at the top of an Mdi parent form. The top-most control is a Panel that is docked to the Top. Immediately below the Panel is a user control that is Anchored to...
2
by: shapper | last post by:
Hello, I have a control named Parent in my page. Parent has many child controls under it which also have other child controls under them. I need to find a control named "A" which i don't know...
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: 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
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
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
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,...
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.