If I run the following code in an ASPX file:
Sub ShowControls()
Dim i As Integer
For i = 0 To 5
plhSurvey.Controls.Add(getTextbox(i.ToString))
Next i
End Sub
Private Function getTextbox(ByVal ID As String) As TextBox
Dim x As New TextBox
x.ID = ID
Return x
End Function
I get the result I want, it shows the textboxes with the ID I specified.
e.g. :
<input name="0" type="text" id="0" />
But when I run this same code in an .ASCX file and load this in a placeholder of an ASPX file, I don't get the ID's that I want.
e.g.:
<input name="_ctl1:0" type="text" id="_ctl1_0" />
Why does he add the _ctl1: to the name and _ctl1_ to the id? Is there anyway I can avoid this from happening? Other than to use an ASPX file instead of an ASCX ofcourse.
Sub ShowControls()
Dim i As Integer
For i = 0 To 5
plhSurvey.Controls.Add(getTextbox(i.ToString))
Next i
End Sub
Private Function getTextbox(ByVal ID As String) As TextBox
Dim x As New TextBox
x.ID = ID
Return x
End Function
I get the result I want, it shows the textboxes with the ID I specified.
e.g. :
<input name="0" type="text" id="0" />
But when I run this same code in an .ASCX file and load this in a placeholder of an ASPX file, I don't get the ID's that I want.
e.g.:
<input name="_ctl1:0" type="text" id="_ctl1_0" />
Why does he add the _ctl1: to the name and _ctl1_ to the id? Is there anyway I can avoid this from happening? Other than to use an ASPX file instead of an ASCX ofcourse.