G
Guest
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
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