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

Export row details

4 Answers 93 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Calin Calin
Top achievements
Rank 1
Calin Calin asked on 10 May 2010, 09:47 AM
Hi,

I have a grid that has as details for each row a different grid (kind like of a invoice / invoice lines). I need to export this grid to a excel document and show the rows like this:
- row1
-r1detail1
-r1detail2
-r1detail3
- row2
-r2detail1
-r2detail2
...

Is there any way I can accomplish this ?

Thank you,
Calin

4 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 10 May 2010, 01:30 PM
Hi Calin Calin,

I am afraid this is still not supported by RadGridView as internal feature.

Regards,
Pavel Pavlov
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
Calin Calin
Top achievements
Rank 1
answered on 10 May 2010, 03:59 PM
Hi Pavel,

Any ideea how can I achieve this ?
I was thinking to break the stream after each row was exported and export the grid from the details in the same stream.
Is there a way to get after the a row was exported ?
If I manage to have a implementation on this I will post it here and maybe you guys can port it as a sample. If should be pretty useful.
Regards,
0
Vlad
Telerik team
answered on 14 May 2010, 09:53 AM
Hi Calin,

With our upcoming latest build you will be able to achieve this using our new ElementExported event. You will have access to the StreamWriter and you will be able to write additional data to the stream. For example:

private void RadGridView1_ElementExported(object sender, GridViewElementExportedEventArgs e)
{
    if (e.Element == ExportElement.Row)
    {
        var obj = e.Context as MyBusinessObject;
        if (obj != null)
        {
            e.Writer.Write(String.Format(@"<tr><td background-color:#CCC;"" colspan=""{0}"">",
                RadGridView1.Columns.Count));

            e.Writer.Write(String.Format(@"ID: {0} <br />", obj.ID));
            e.Writer.Write(String.Format(@"Name: {0} <br />", obj.Name));

            e.Writer.Write("</td></tr>");
        }
    }
}

I've attached an example project with our latest binaries plus Excel output.

Greetings,
Vlad
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
Joe
Top achievements
Rank 1
answered on 01 Dec 2011, 06:23 AM
This is not intended, is it?
So, i have something like this:

row1
column1
column2
colum3
row1_rowdetails
    rowdetails1
    rowdetails2
row2
column1
column2
colum3
row2_rowdetails
    rowdetails1
    rowdetails2

how can I get both row columns and rowdetails exported?
Tags
GridView
Asked by
Calin Calin
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Calin Calin
Top achievements
Rank 1
Vlad
Telerik team
Joe
Top achievements
Rank 1
Share this question
or