473,385 Members | 1,720 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,385 software developers and data experts.

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 1436

"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
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.