473,794 Members | 2,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataList Not Listed in ControlCollecti on

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:DataList 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.DataI tem("FirstName" ) %></td>
<td><%# Container.DataI tem("LastName") %></td>
<td><%# Container.DataI tem("EMail") %></td>
</tr>
</ItemTemplate>
<FooterTemplate >
</table>
</FooterTemplate>
</asp:DataList>
</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.C ount - 1
Response.Write( Form.Controls.I tem(i).ToString & "<br>")
Next
End Sub
</script>

Surprisingly, the DataList doesn't get listed as one of the Controls in
the ControlsCollect ion 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 ControlCollecti on
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.

Nov 28 '06 #1
1 1225
The best way to see the controls is to look at the trace output. It will
essentially walk down through the control list. I believe that DataLists,
Repeaters and the like are treated differently and essentially show up as
Literal content instead of an actual DataList showing up. Enable tracing and
look through the control tree on the trace and you should be able to spot it
in the control list.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

<rn**@rediffmai l.comwrote in message
news:11******** **************@ j72g2000cwa.goo glegroups.com.. .
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:DataList 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.DataI tem("FirstName" ) %></td>
<td><%# Container.DataI tem("LastName") %></td>
<td><%# Container.DataI tem("EMail") %></td>
</tr>
</ItemTemplate>
<FooterTemplate >
</table>
</FooterTemplate>
</asp:DataList>
</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.C ount - 1
Response.Write( Form.Controls.I tem(i).ToString & "<br>")
Next
End Sub
</script>

Surprisingly, the DataList doesn't get listed as one of the Controls in
the ControlsCollect ion 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 ControlCollecti on
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.

Nov 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5646
by: K | last post by:
Can anyone tell me why VB can successfully inherit from the ControlCollection class but C# can't? When compiling the following 2 classes, the C# version gets a compile error of: "No overload for method 'ControlCollection' takes '0' arguments" // C#
10
2856
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I have to add a datalist control. Using this datalist control I should be able to add edit, modify and cancel the items listed in this control. Here is how I designed. I used placeholder to add the controls dynamically to the page on the click...
1
1681
by: .Net Sports | last post by:
I am resurrecting an old script from a previous programmer, and want to migrate it over to asp.net from classic asp. Tho there are other peripheral parts of the script (that really have no bearing on the core, in which I will explain), the main core is the concern. I have a daily feed from a horseracing prognosticator that gets put into an sql database on a daily basis for roughly 15 popular racetracks. A user (who will need a...
1
1676
by: DanielSchaffer | last post by:
I am trying to create a class that inherits fromControlCollection, but I am getting the compile error "Nooverload for method 'ControlCollection' takes '0' arguments",and VS highlights the constructor method: public AvailabilityCollection(Control owner) { _owner = owner; } Here is what the .NET SDK has for the ControlCollectionconstructor: public ControlCollection( Control owner );
3
2350
by: Phill. W | last post by:
Is it possible to extend the Windows.Forms.Form.ControlCollection class and override it's Add method? I'm adding controls to a Form and want to hook up Event Handling for the Form to deal with on behalf of each Control. I /thought/ the best way to do this would be to inherit from and override the Add method on the Form.ControlCollection class and put some AddHandler statements in there. This much I can do but the bit I'm missing is...
2
1503
by: Laura K | last post by:
I would like to create a nested datalist inside the selecteditemtemplate of a datalist. My hope is that when a user clicks on a link a set of child links is displayed. For example if the user clicks men's clothing he would get a list of sub categories like pants, shirts, shorts etc I have put together the following and I get the original datalist fine. When I try to get the sublist I get the following error: Object reference not set to...
3
1520
by: Aaron | last post by:
How do I get all the name(s) listed in the datalist? <asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1"> <ItemTemplate> <table> <tr>
1
1888
by: Brock | last post by:
First note that I am using Framework 1.1. I have an .aspx page that is displaying a list of employees, but only the Employee Number, First Name, Last Name, and Title. It is working great. I recessed it in a <Div></Divto allow scrolling of just the data, not the page. What I need to do is place a DataList (also in a <Div></Divto allow scrolling of just the data) to the right of the Datagrid to show 40 Employee Detail fields (listed top to...
1
1921
by: Brock | last post by:
Thanks in advance... (you can see a screenshot of what my form looks like currently at http://www.juggernautical.com/DataGrid.jpg - the Datalist is super-imposed in 'design view' but the DataGrid is the actual running of the page) I've almost got this working (?) but need a little help. I have an .aspx page that has a DataGrid listing employees with a "Select" button that is to be used to populate the DataList to the right of the DataGrid...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9037
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.