This is a migrated thread and some comments may be shown as answers.

GridGroupFooterItem Excel Export Formatting

4 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 07 Jun 2010, 10:38 PM
I am having trouble formatting one column in the grouped footer.  
I can access the GridDataItems by "item" or "e" but I have NO idea how to access the grouped footer items and change their style.


Below is what I have for code in regards to exporting to Excel and formatting the GridDataItems, but I need to format the GroupedFooterItems.

 
 protected void RadGrid1_ExcelExportCellFormatting(object source, ExcelExportCellFormattingEventArgs e)  
    {  
        GridDataItem item = e.Cell.Parent as GridDataItem;  
        item.Style["background-color"] = "#ffffff";  
        e.Cell.Style["text-align"] = "center";  
    } 

 Help please!

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 08 Jun 2010, 09:29 PM
Hello Mike,

You can access the GridGroupFooterItem on ItemCreated/ItemDataBound events as explained in the following topic:
Word/Excel export (HTML-based) (see Using ItemCreated/ItemDataBound)

protected void RadGrid1_ItemCreated(object  sender, GridItemEventArgs e)
{
   if (e.Item is GridGroupFooterItem && isExport)
       e.Item.Style["background-color"] = "#EEAAEC";
}

Let me know if you need more information.

Regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Mike
Top achievements
Rank 1
answered on 08 Jun 2010, 09:33 PM
Daniel,

How can I find the UniqueName in the ItemCreated?

0
Daniel
Telerik team
answered on 10 Jun 2010, 09:45 PM
Hello Mike,

You have two options:
1) traverse all columns and select the cells by the unique name of the relevant column
2) directly get the cells by the unique name

Regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Mike
Top achievements
Rank 1
answered on 10 Jun 2010, 09:58 PM
This is what I am going to do!
TableCell totalPrice = (e.Item as GridGroupFooterItem)["TotalPrice"];  
totalPrice.Style["mso-number-format"] = "\\#\\,\\#\\#0,000"; 
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Mike
Top achievements
Rank 1
Share this question
or