G
Guest
I have the following problem: I’m creating a hidden control dynamically in
the page_load event handler using the following code
C#:
..
HtmlInputHidden Hidden1 = new HtmlInputHidden();
Hidden1.Name = "Hidden1";
Hidden1.Value = "This is the Hidden Value";
this.PlaceHolder.Controls.Add(Hidden1);
..
HTML:
..
<form id="MainForm" method="post" runat="server">
<asplaceHolder Runat="server" ID="PlaceHolder"></asplaceHolder>
</form>
..
I would expect the name of the hidden control in the resulting HTML code
sent to the browser to be “Hidden1â€. However, the HTML produced looks like
this:
<input name="_ctl0" type="hidden" value="This is the Hidden Value" />
I there a different way to name the control in code?
the page_load event handler using the following code
C#:
..
HtmlInputHidden Hidden1 = new HtmlInputHidden();
Hidden1.Name = "Hidden1";
Hidden1.Value = "This is the Hidden Value";
this.PlaceHolder.Controls.Add(Hidden1);
..
HTML:
..
<form id="MainForm" method="post" runat="server">
<asplaceHolder Runat="server" ID="PlaceHolder"></asplaceHolder>
</form>
..
I would expect the name of the hidden control in the resulting HTML code
sent to the browser to be “Hidden1â€. However, the HTML produced looks like
this:
<input name="_ctl0" type="hidden" value="This is the Hidden Value" />
I there a different way to name the control in code?