Home All Groups Group Topic Archive Search About

DataList - How to programmatically add a separator row

Author
20 Nov 2007 10:56 PM
Tony_VBACoder
With ASP.NET 2.0 VB.NET, how do I:

I have a multi-column (4 columns) DataList control on my WebForm that
displays sports teams for our league.  The data is grouped by Division Names
where there are 4 teams per Division.  When the data is displayed on the Web
Page, it will be a 4x4 (4 columns by 4 rows) grid.  What I need to be able to
do is, add a separator row whenever the Division Name changes and display
that Division name such that it spans across 4 columns.

I have a stored procedure that sorts the data by Division name, so the data
is already coming in sorted by Division.  All I need to be able to do is
detect when the Division name changes, and then add a new row to the DataList.

I have done something similar using a GridView control and the "Protected
Overrides Sub Render(ByVal writer As HtmlTextWriter)" event, but I can't seem
to find any examples of how to do this with a DataList control.

AddThis Social Bookmark Button