Monday, March 14, 2011

ASP.NET 4.0 –List View Control Enhancement

With asp.net 3.5 we are having a great control called list view its provide almost all the functionality like grid view and its rendering is also easy but in asp.net 3.5 you need to specify a layout template where in asp.net 4.0 layout template is not required. So no need to include one extra placeholder as layout template. Like in asp.net 3.5 you nee do render formview control like following.
<asp:ListView ID="myListView" runat="server">
<LayoutTemplate>
  <asp:PlaceHolder ID="LayoutPlaceHolder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
  <% Eval("myDataBaseColumn")%>
</ItemTemplate>
</asp:ListView>
This can be replaced by following in asp.net 4.0. Now no need to for layout template like following.
<asp:ListView ID="myListView" runat="server">
<ItemTemplate>
  <% Eval("myDataBaseColumn")%>
</ItemTemplate>
</asp:ListView>
Hope this will help you..Happy coding..

No comments:

Popular Posts