View Full Version : [CLOSED] id generator question

Jun 25, 2014, 2:55 AM
i create a window on code behind, items on the window is created on codebehind. i name a id "tf_uname" to the textfield , but the brower render the name to "ctl00_tf_uname" , there is "ctl00_" before every control , i want to render the name no change.
how to do
code behind

var tfName = new TextField
ID = "tf_uname",
FieldLabel = "用户名",
AnchorHorizontal = "100%",
Margin = 4,
LabelWidth = 70


<input id="ctl00_tf_uname-inputEl" type="text" size="1" name="ctl00_tf_uname" class="x-form-field x-form-text" autocomplete="off" aria-invalid="false" data-errorqtip="" style="width: 100%;">

Jun 25, 2014, 3:23 AM
The Prefix is added by the ASP.NET runtime to ensure the .id is unique. The Prefix is added by the runtime because you are adding the Control into a NamingContainer, such as a MasterPage.

You can override this "feature" of ASP.NET by setting the .IDMode property of the Control, or it's parent.

Hope this helps.