0% found this document useful (0 votes)
16 views

Example

This document provides code examples for using ASP.NET data controls like DropDownList and DataList to display and select data. It shows binding a DataList control to display employee data from a data source on page load. The DataList code contains templates for the header, items, and footer to display the employee data in a table format.

Uploaded by

Selva Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Example

This document provides code examples for using ASP.NET data controls like DropDownList and DataList to display and select data. It shows binding a DataList control to display employee data from a data source on page load. The DataList code contains templates for the header, items, and footer to display the employee data in a table format.

Uploaded by

Selva Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Web:

Example: <asp:dropdownlist id="countries" runat="server"> <asp:listitem Text="Select" Value=""/> <asp:listitem Text="UK" Value="UK"/> <asp:listitem Text="Ireland" Value="Ireland"/>

</asp:dropdownlist> <asp:DataList ID="DataList1" runat="server"> <HeaderTemplate> <table border="1"> <tr> <th>

For More Information: www.packtpub.com/asp-net-data-presentation-controls/book Chapter 4 [ 97 ]

Employee Code </th> <th> Employee Name </th> <th> Basic </th> <th> Dept Code </th> </tr> </HeaderTemplate> <ItemTemplate> <tr bgcolor="#0xbbbb"> <td> <%# DataBinder.Eval(Container.DataItem, "EmpCode")%> </td> <td> <%# DataBinder.Eval(Container.DataItem,

"EmpName")%> </td> <td> <%# DataBinder.Eval(Container.DataItem, "Basic")%> </td> <td> <%# DataBinder.Eval(Container.DataItem, "DeptCode")%> </td> </tr> </ItemTemplate> <FooterTemplate> </FooterTemplate> </asp:DataList> The DataList control is populated with data in the Page_Load event of the web form using the DataManager class as usual. protected void Page_Load(object sender, EventArgs e) { DataManager dataManager = new DataManager(); DataList1.DataSource = dataManager.GetEmployees();

DataList1.DataBind(); }

You might also like