In your ItemDataBound handler:

protected void grid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
      if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
      {
            if (yourCondition == true)
            {
                  DataGridItem item = new DataGridItem(0, 0, ListItemType.Separator);
                  item.Cells.Add(new TableCell());
                  item.Cells[0].ColumnSpan = e.Item.Cells.Count;
                  item.Cells[0].Text = "whatever";
                  Table t = (Table)e.Item.Parent;
                  t.Rows.AddAt(t.Rows.Count - 1, item);
            }
      }
}

-Brian

-----Original Message-----
From: Mesut "G�rb�z [mailto:[EMAIL PROTECTED]
Sent: Monday, October 25, 2004 8:23 AM
To: [EMAIL PROTECTED]
Subject: [C#.NET] asp Datagrid


hi all,

i run a query and bind it to the aspdatagrid. For example 20 rows returned after the running. My aim is to add a row to the aspdatagrid after every five rows.

i want datagrid to view like this.

ID��� Name Salary
1���� xx������ 100
2���� xx������ 200
3���� xx������ 150
4���� xx������ 250
5���� xx������ 300
------------------------
avarage����� 200��������� // the adding row after the fifth row
------------------------
6���� xx������ 100
7���� xx������ 200
8���� xx������ 150
9���� xx������ 250
10���� xx������ 300
------------------------
avarage����� 200��������� // the adding row after the fifth row
------------------------

Does datagrid have such a property like above?
Written things to the added row is not important. The above is just a sample as i want. it can be avarage, sum or something else. My first and important aim is to add a row after a condition and this condition isn't important. Anyway, How can i add a row into aspdatagrid?

Thanks...

����� �����
---------------------------------
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.

[Non-text portions of this message have been removed]



Yahoo! Groups Sponsor
ADVERTISEMENT





Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/CSharpNET/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=315388.5500238.6578046.3001176/D=groups/S=:HM/A=2372354/rand=221517043


Yahoo! Groups Links

Reply via email to