The right way to do it would be to add another table, with a relationship
and nest your grids.
The only alternative I can think of is to do complicated stuff
onItemDataBound checking to see if the section has changed:
<ItemTemplate>
<tr id="sectionHeader" runat="server">
<td colspan="2"><%# Databinder.Eval(Container.DataItem, "SectionId")
%></td>
</tr>
<tr>
<td> </td>
<td><%# Databinder.Eval(Container.DataItem, "Name") %></td>
</tr>
</ItemTemplate>
then onItemDataBound
private int oldSectionId = 0;
if (e.Item.ItemType == Item || e.Item.ItemType == AlternatingItem){
HtmlTableRow tr = (HtmlTableRow)e.item.FindControl("sectionHeader");
int sectionId = Convert.ToInt32(((DataRowView)e.DataItem)["sectionId"]);
if (sectionId != oldSectionId){
oldSectionId = sectionId;
tr.visible = true;
}else{
tr.visible = false;
}
}
Code is just off the top of my head, so won't compile, but it ought to give
you an idea. You can check out my article on DataBinding for more on
OnItemDataBound and Nested controls:
http://openmymind.net/databinding/index.html
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Anthony" <an***********@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
Hi there,
I have a simpletable that i have succesfully bound to a datalist..
It just shows name, description and image.. FINE.. However i would now
like to simply split them into sections i.e 1,2,3,4.. So i added
another field to the table called section..
However this is proving really hard.. Basically all i want is:
1..............
section1
2............
section2
3............
section3
This is basic as it gets so i dont really want to add a new table just
for these section categories.. Can this be achieved by using an array
for the categories or something similar