| |||||||||||
BaseDataList.Controls PropertySystem.Web.UI.WebControls Namespace BaseDataList Class Returns the collection of child controls for a specified data listing control. Syntax
This property can only be used programmatically; it cannot be set when declaring the control. Property Value
RemarksThe Controls collection enables programmatic access to the child controls contained in a data listing control. You can use this property to obtain information about each control in the collection. For every header, footer, separator, and data item defined within the opening and closing tags of a DataList or DataGrid, ASP.NET automatically adds one DataListItem or DataGridItem object to the respective Controls collection. In the case of data items, ASP.NET adds one DataListItem or DataGridItem to the collection for each record in the DataSource. Any data-bound HTML tags or text strings that are not processed on the server, such as those defined for the Item and AlternatingItem templates of the corresponding class, are treated as DataBoundLiteralControl objects, and are added to the collection. Any HTML tags or text strings that are not data-bound, such as those defined for the Header and Footer templates of the corresponding class, are treated as LiteralControl objects, and are added to the collection as well. Like most collections in the .NET Framework, you can add to, remove from, or iterate through the list of items in this collection. ExampleThe below snippet shows how to programmatically access the collection of child controls ( as well as their child controls ) in a DataList. In this case, the sample simply determines and displays the type and UniqueID of each child control. Notice in the output that the first control ( the header item ) contains a child literal control, whereas the rest of the controls ( the data items ) contain data-bound literal controls.
See Also |
| ||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme