|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Placeholder Object Questionthat 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
Show quote
Hide quote
"JohnJohn" <JohnJ***@discussions.microsoft.com> wrote in message If I understand correctly, you want to get a reference to the textbox in the news:6C26BF8E-435E-4849-8DA5-6153924C8E04@microsoft.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 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
Threading
Lost my Design view for a Windows Form (VB 2005) Last Modified date for the Source code. Export CR to Excel problem Launch new instance of IE?? Help with Datagridviews dll & Web Service in VB.Net 2005 Stored Procedure text file to datatable to SQL2005 table not working VB.NET/2005 Application crash problem in crystal report |
|||||||||||||||||||||||