G
Guest
I need help converting the VB code
Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
Dim cntrlTester As Control
Dim chkTester As CheckBox
Dim sb As New System.Text.StringBuilder
For Each cntrlTester In _
Page.Controls(1).Controls
If TypeOf cntrlTester Is _
System.Web.UI.WebControls.CheckBox Then
chkTester = cntrlTester
sb.Append(chkTester.ID & _
" : " & chkTester.Checked.ToString & _
"<br>")
End If
Next
Label1.Text = sb.ToString
End Su
<form id="Form1" method="post" runat="server"><p><asp:CheckBox id="CheckBox1" runat="server"
text="checkbox1"></asp:checkbox></p><p><asp:CheckBox id="CheckBox2" runat="server"
text="checkbox2"></asp:checkbox></p><p><asp:CheckBox id="CheckBox3" runat="server"
text="checkbox3"></asp:checkbox></p><p><asp:Label id="Label1" runat="server"></asp:label></p><p><asp:Button id="Button1" runat="server" text="button"></asp:button></p></form
TO C# code for Visual Studio .NE
Thanks
bebo
Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
Dim cntrlTester As Control
Dim chkTester As CheckBox
Dim sb As New System.Text.StringBuilder
For Each cntrlTester In _
Page.Controls(1).Controls
If TypeOf cntrlTester Is _
System.Web.UI.WebControls.CheckBox Then
chkTester = cntrlTester
sb.Append(chkTester.ID & _
" : " & chkTester.Checked.ToString & _
"<br>")
End If
Next
Label1.Text = sb.ToString
End Su
<form id="Form1" method="post" runat="server"><p><asp:CheckBox id="CheckBox1" runat="server"
text="checkbox1"></asp:checkbox></p><p><asp:CheckBox id="CheckBox2" runat="server"
text="checkbox2"></asp:checkbox></p><p><asp:CheckBox id="CheckBox3" runat="server"
text="checkbox3"></asp:checkbox></p><p><asp:Label id="Label1" runat="server"></asp:label></p><p><asp:Button id="Button1" runat="server" text="button"></asp:button></p></form
TO C# code for Visual Studio .NE
Thanks
bebo