What do you mean by group? It appears all you want to do is suppress Field
A from displaying when it has the same value as the previous row. This is
easy to do with a module level variable. This example is for a DataGrid,
but it should work the same for a repeater.
private void dg_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
DataRowView drCurr = (DataRowView)e.Item.DataItem;
if(m_sPrevFieldA == (string)drCurr["FieldA"])
e.Item.Cells[0].Text="";
m_sPrevFieldA= (string)drCurr["FieldA"];
}
}
HTH,
Dean Fiala
-----------------------------
Very Practical Software, Inc.
http://www.vpsw.com/links.aspx
-----Original Message-----
From: monza_s [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 11:38 AM
To: [EMAIL PROTECTED]
Subject: [AspNetAnyQuestionIsOk] Grouping Data from a single table
I am getting some data out from a single database table, which has
field A and field B. I would like to group all of field B data under
field A in asp.net.
My current data looks like
Field A Field B
a aaa
a abc
a def
b xyz
b pqr
c bbb
d klm
d hhh
I would like for it to look like
Field A Field B
a aaa
abc
def
b xyz
pqr
c bbb
d klm
hhh
Any idea how to go about it? At present I am using a repeater to get
the data.
Thanks
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/