D
dodgeyb
I'm trying to check my html checkbox from a postback. This works fine:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim chk As HtmlInputCheckBox
chk = CType(FindControl("chk101228"), HtmlInputCheckBox)
chk.Checked = False
End Sub
However, if I generate the htmlcheckbox on page load event and write
it out to a literal control, the above procedure fails - control
cannot be found.
Protected Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Form1.Load
Me.literal1.Text = "<input runat='server' type='checkbox'
name='chk101228' id='chk101228' checked='checked' />"
End Sub
Why is this ?
Cheers
Chris
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim chk As HtmlInputCheckBox
chk = CType(FindControl("chk101228"), HtmlInputCheckBox)
chk.Checked = False
End Sub
However, if I generate the htmlcheckbox on page load event and write
it out to a literal control, the above procedure fails - control
cannot be found.
Protected Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Form1.Load
Me.literal1.Text = "<input runat='server' type='checkbox'
name='chk101228' id='chk101228' checked='checked' />"
End Sub
Why is this ?
Cheers
Chris