Footer data - more than one row (sumarizing)

M

Miguel Ramirez

Hello All,

How can I add two rows on a datagrid footer for totals.
I am displaying month sales for each customer on a datagrid, but for footer
totals I want to display totals for customer as well as for region.
So far I can only add one row totals in footer.

I was thinking maybe to do it with a second datgrid, but how to place the
second datagrid just after the other datagrid finished on the page.

Any help will be really appreciated.

Best regards,


Miguel.
 
P

Pawan

Hi Miguel,
There is an event available on Datagrid ..
ItemDataBound .... This event is basically fired when
DataBind is called upon DataGrid control. You can use this
Event to generate an extra row in the templtate Footer by
adding this line of code ...


private void dgrdContacts_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Footer)
{
DataGridItem dgItem;
TableCell dgCell;
dgItem = new DataGridItem(0, 0, ListItemType.Header);
dgCell = new TableCell();
dgCell.ColumnSpan = 2; //Colspan according to ur need
dgItem.Cells.Add(dgCell);
dgCell.Text = "blah blah blah";
dgrdContacts.Controls[0].Controls.AddAt(0,dgItem);
}
}

Hope this helps you out ..
Keep goood and stay blessed.

Pawan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top