R
rn5a
An ASP.NET Form has different server controls like Panels, Labels,
TextBoxes, HiddenFields etc. The Form has a DataList as well. This is
how the DataList looks:
<form runat="server">
<asp
ataList ID="dlUsers" runat="server">
<HeaderTemplate>
<table border=2>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>E-Mail</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Container.DataItem("FirstName") %></td>
<td><%# Container.DataItem("LastName") %></td>
<td><%# Container.DataItem("EMail") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp
ataList>
</form>
Note that the Form houses other web server controls as well like
Panels, Labels, HiddenFields etc. Now when I do
<script runat="server">
Sub Page_Load(obj As Object, ea As EventArgs)
Dim i As Integer
For i = 0 To Form.Controls.Count - 1
Response.Write(Form.Controls.Item(i).ToString & "<br>")
Next
End Sub
</script>
Surprisingly, the DataList doesn't get listed as one of the Controls in
the ControlsCollection though the other controls like Panels, Labels
etc. do get listed. What's causing this abnormality?
The same happens when I iterate through the Page's ControlCollection
i.e. the DataList doesn't get listed as one of the controls though the
other server controls do!
Note that I am not adding the DataList dynamically.
TextBoxes, HiddenFields etc. The Form has a DataList as well. This is
how the DataList looks:
<form runat="server">
<asp
<HeaderTemplate>
<table border=2>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>E-Mail</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Container.DataItem("FirstName") %></td>
<td><%# Container.DataItem("LastName") %></td>
<td><%# Container.DataItem("EMail") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp
</form>
Note that the Form houses other web server controls as well like
Panels, Labels, HiddenFields etc. Now when I do
<script runat="server">
Sub Page_Load(obj As Object, ea As EventArgs)
Dim i As Integer
For i = 0 To Form.Controls.Count - 1
Response.Write(Form.Controls.Item(i).ToString & "<br>")
Next
End Sub
</script>
Surprisingly, the DataList doesn't get listed as one of the Controls in
the ControlsCollection though the other controls like Panels, Labels
etc. do get listed. What's causing this abnormality?
The same happens when I iterate through the Page's ControlCollection
i.e. the DataList doesn't get listed as one of the controls though the
other server controls do!
Note that I am not adding the DataList dynamically.