views:

16

answers:

0

I am using Master Pages and I am truing to dynamically add hidden text boxes on the form with the NAMEs that Google Checkout expects.

<input name="item_name_1" type="hidden" value="Widget #1"/>

Using VB.NET, I execute the following code

'Name
Dim hidName As New HtmlInputHidden
hidName.ID = "item_name_" & count.ToString
hidName.Value = item
Form.Controls.Add(hidName)

But because I use Master Pages, the control is renamed to "ctl00$item_name_1".

<input name="ctl00$item_name_1" type="hidden" id="ctl00_item_name_1" 

Note that I tried to set the Name property (hidName.Name = "item_name_" & count.ToString) and also tried to add the name to the Attributes list. This strangely had no effect on the name attribute whatsoever. When I am not using master pages, I notice that when I set the ID property the NAME is automatically assigned the same value.

Is there a way to control the name of a dynamically added control when you are using master pages?