asp.net listview


Every asp.net listview control must have a Layout Template section. The Layout Template is the root section of the listview control. It expects a control that holds the place of the data such as a table row element of an html table for those items specified in the itemtemplate secion or for groups specified in the GroupTemplace section. This control HAS to HAVE the runat=”server” attribute and the ID must be set to the id of the ItemPlaceHolderID or the GroupPlaceHolderID specified in the listview properties or in the listview tag declaration.

For example, note in the following snapshot of the Properties window for a listview “lvSales” we have the ItemPlaceholderID set to “itemPlaceHolder” (you can name it whatever you want)

clip_image002

The ItemPlaceholderID in the properties of the listview must match the ID in the PlaceHolder tag:

<LayoutTemplate>

<asp:PlaceHolder ID="itemPlaceholder" runat="server" />

</LayoutTemplate>

Here is the asp.net listview template structure:

<asp:ListView . . .>

<LayoutTemplate></LayoutTemplate>

<GroupTemplate></GroupTemplate>


<GroupSeparatorTemplate></GroupSeparatorTemplate>




<ItemTemplate></ItemTemplate>


<AlternatingItemTemplate></AlternatingItemTemplate>




<EditItemTemplate></EditItemTemplate>





<ItemSeparatorTemplate></ItemSeparatorTemplate>




</asp:ListView>

No comments:

Post a Comment