A
Andreas Klemt
Hello,
I have this:
<table id="myTable" runat="server">
<tr>
<td><asp:label id="lblText" runat="server"></asp:label>
<asp:button id="btn1" runat="server"></asp:button>
<asp:button id="btn2" runat="server"></asp:button>
<asp:button id="btn3" runat="server"></asp:button>
</td>
</tr>
</table>
Now I want to loop through like this:
For Each ctl As Control In Me.myTable.Controls
If TypeOf ctl Is Button Then
CType(ctl, Button).Enabled = False
End If
Next
But this doesn't work because in Me.myTable.Controls
there is only 1 Control. Why is this wrong and what is the correct way?
Thanks in advance,
Andreas
I have this:
<table id="myTable" runat="server">
<tr>
<td><asp:label id="lblText" runat="server"></asp:label>
<asp:button id="btn1" runat="server"></asp:button>
<asp:button id="btn2" runat="server"></asp:button>
<asp:button id="btn3" runat="server"></asp:button>
</td>
</tr>
</table>
Now I want to loop through like this:
For Each ctl As Control In Me.myTable.Controls
If TypeOf ctl Is Button Then
CType(ctl, Button).Enabled = False
End If
Next
But this doesn't work because in Me.myTable.Controls
there is only 1 Control. Why is this wrong and what is the correct way?
Thanks in advance,
Andreas