473,473 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Placeholder Object Question

Hello. I have a VB.NET 2005 web application. I set up a placeholder control
that I use to optionally add a textbox control at runtime (doesn't happen
every time). This works very well. However, I need to be able to manipulate
the value (via client-side scripting) in the textbox after the page is
rendered. In order to do that, I need to know the value of the "Name"
attribute that is assigned to my textbox by the placeholder control.

Does anyone know how I can obtain the "name" attribute assigned to the
textbox BEFORE the page is rendered? I tried SETTING the value of the name
attribute, but that doesn't work...it still uses the name it generates, and
ADDS the name attribute that I specified. The net effect of that is that the
name I specified gets ignored. It names my textbox something like "ctl02".
Incidentally, here is the code I use to create the textbox at runtime:

Dim thisTextBox As TextBox = New TextBox
thisTextBox.Text = FormatNumber(thisTranFee, 2, -1, 0, -1)
thisTextBox.Style("TEXT-ALIGN") = "Right"
thisTextBox.Attributes.Add("onchange", "CalcTotalPayoff()")
thisTextBox.Attributes.Add("ID", "TransFee")
thisTextBox.Width = 100
ph_TransactionFee.Controls.Add(thisTextBox)

Thanks in advance,
John
Jun 9 '06 #1
1 1437

"JohnJohn" <Jo******@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
Hello. I have a VB.NET 2005 web application. I set up a placeholder
control
that I use to optionally add a textbox control at runtime (doesn't happen
every time). This works very well. However, I need to be able to
manipulate
the value (via client-side scripting) in the textbox after the page is
rendered. In order to do that, I need to know the value of the "Name"
attribute that is assigned to my textbox by the placeholder control.

Does anyone know how I can obtain the "name" attribute assigned to the
textbox BEFORE the page is rendered? I tried SETTING the value of the
name
attribute, but that doesn't work...it still uses the name it generates,
and
ADDS the name attribute that I specified. The net effect of that is that
the
name I specified gets ignored. It names my textbox something like
"ctl02".
Incidentally, here is the code I use to create the textbox at runtime:

Dim thisTextBox As TextBox = New TextBox
thisTextBox.Text = FormatNumber(thisTranFee, 2, -1, 0, -1)
thisTextBox.Style("TEXT-ALIGN") = "Right"
thisTextBox.Attributes.Add("onchange", "CalcTotalPayoff()")
thisTextBox.Attributes.Add("ID", "TransFee")
thisTextBox.Width = 100
ph_TransactionFee.Controls.Add(thisTextBox)

Thanks in advance,
John


If I understand correctly, you want to get a reference to the textbox in the
client-side script. To get the reference, you need to use the id of the
textbox...as seen on the client...

You have to use textBox1.ClientID to get the id...but ClientID is on the
server...so you'll have to pass that to the client script call (onclick or
whatever).

HTH,
Mythran

Jun 9 '06 #2

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

Similar topics

4
by: patrick_a | last post by:
Hello, I am trying to insert multiple instances of a custom user control into a placeholder on an aspx page, based on the records retrieved from the database. I use the datareader to loop through...
2
by: theo | last post by:
Hi... I wish to extract the text content of an Xml file and assign it to DropDownList controls at runtime.I can get the Xml file text content into the DropDownList controls (Ex...if 5 Xml text...
4
by: theo | last post by:
Program flow...load file,then extract the xml text tags from the file,then the number of Xml tags retrieved from the file determines the number of dropdownlist controls instanciated in the...
0
by: dwhitford | last post by:
I'm using a placeholder control to dynamically add textboxes to the web page. When the page loads I dynamically create a set of textboxes give them an id and a value. When the page postback I...
2
by: Mike Speak | last post by:
I have a user control that I want to use to render 4 menu items (retrieved from db) on the top of each of my asp.net pages. The user control defines a table, with one TR and one TD. Within the...
2
by: Chad Crowder | last post by:
Is it possible to create a placeholder inside a template column of a datagrid? My goal is to use a placeholder, and during runtime add user controls to the placeholder as the items in the datagrid...
3
by: Oren | last post by:
hi, How can I retrieve the Control (wucState.ascx) from the Placeholder at the even: btn_Click: //declaration at page protected wucState WucState1; -- my control .... private void...
6
by: David Colliver | last post by:
Hi, using vb.net 1.1 I am trying to add a control to a placeholder but am having problems with it. I do it practically the same way as i do in C# (I have more C# skill than VB.NET)and I...
7
by: Brad Baker | last post by:
I am trying to programmatically set a placeholder control in csharp which is nested inside a repeater control between <ItemTemplateand </ItemTemplate> tags, however I am running into problems. I've...
0
by: F | last post by:
Hi, The funniest part of the problem described here is that I am not new to ASP.NET, but honestly here I have no idea about what's going on. I have a GridView with a data source that just...
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,...
1
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,...
1
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.