Placeholder control

  • Thread starter Thread starter tma
  • Start date Start date
T

tma

Why does the following code generate the following HTML? I would think the
"name" attribute would be = "amount". Each control I add to the placeholder
is added with a name=_ctl0, then name=_ctl1, then name=_ctl2, etc. Am I
missing something?

How can I specify the "name" attribute with a "type=hidden"
HtmlInputControl?

phP is a placeholder control in my aspx form.

Dim myInput As HtmlInputHidden = New HtmlInputHidden
myInput.Name = "amount"

myInput.Value = "80.00"

phP.Controls.Add(myInput)



<input name="_ctl0" type="hidden" value="80.00" />

Thanks.
 
Try doing the following instead:

(In C# if you don't mind)

Page.RegsiterHiddenField("myInputName", "foobar");

This should have the same effect (just that it won't be
placed in a particular spot).

Let me know if this helps.

~Chuck.
 
try:

Dim myInput As HtmlInputHidden = New HtmlInputHidden
myInput.Id = "amount"
myInput.Value = "80.00"
phP.Controls.Add(myInput)
 
That appears to work. Is it a bug in VS.NET?

bruce barker said:
try:

Dim myInput As HtmlInputHidden = New HtmlInputHidden
myInput.Id = "amount"
myInput.Value = "80.00"
phP.Controls.Add(myInput)
 
Back
Top