Why DataList Control Is Not Visible On Page?
When you drag DataList control from the toolbox to web form, gray rectangle is displayed, like in image bellow:
If you try to run the page, nothing will be displayed. This happen because DataList control requires
ItemTemplate defines how DataList control will look at run time. You can mix HTML and ASP.NET markup do design appropriate look. This simple example shows customers names listed in DataList control:
<asp:DataList id="dlCustomers" runat="server">
<ItemTemplate>
<b>Customer name:</b> <%#DataBinder.Eval(Container.DataItem, "FirstName")%>
<%#DataBinder.Eval(Container.DataItem, "LastName")%>
</ItemTemplate>
</asp:DataList>
Related articles:
1. Data Source Controls in ASP.NET 2.0
Copyright © 2002-2008 Bean Software. All rights reserved.