Wednesday, November 30, 2022
Code Search
Code Bank
.NET Applications
XSD Schema Generator
.NET/XML Training


Time Allocation Grid: Extending the DataGrid

The DataGrid WebControl provides an enormous of functionality that can be used to display and collect data in a Web application. This sample application provides a more advanced look at how the DataGrid control can be extended to create a Time Allocation System to associate employee hours with specific work codes for reporting and scheduling purposes.

The derived grid (named WeekGrid) allows data from a variable number of weeks to be captured, allows end users to insert and delete rows dynamically, has built-in validation support for data types and maximum allowed hours, as well as print functionality:

The custom grid supports multiple headers, leverages the ITemplate interface to dynamically create column templates, exposes events, handles preserving state between user posts, plus much more. So why is the grid featured on the XML for ASP.NET Developers Website given that the site focuses on XML and Web Services? Behind the scenes it leverages XML schemas to track state. The sample also demonstrates how to bind XML to the grid.

The following code demonstrates how the grid can be added into an ASP.NET Web Form. Click the "View Source Code" link below to view all of the code for the grid as well as the sample ASP.NET page:

<TAS:WeekGrid id="TASGrid1" runat="server" WeekDayNames="Mon,Tues,Wed,Thurs,Fri,Sat,Sun" TopHeaderColor="navy" MaxHours="80" RowDayCellsCount="14"> <AlternatingItemStyle BackColor="AliceBlue"> </AlternatingItemStyle> <ItemStyle HorizontalAlign="Center"> </ItemStyle> <HeaderStyle Font-Size="10pt" Font-Bold="True" HorizontalAlign="Center" ForeColor="Black" BackColor="#CCCCCC"> </HeaderStyle> <FooterStyle HorizontalAlign="Center" BackColor="#CCCCCC"> </FooterStyle> </TAS:WeekGrid>

Teaches DataGrid, XML, XML Schemas, ITemplate
Requirements .NET 1.0
View Source Code: Click Here
Download Code: Click Here


.NET, SharePoint and Silverlight Training Solutions
    Online, Onsite and Video Training on .NET and SharePoint technologies available through The Wahlin Group.

© 2007 Wahlin Consulting LLC
XML for ASP.NET Developers in bookstores