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

Problem with ElementExporting event in RadGridView.

3 Answers 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 20 Jan 2011, 09:03 PM

Hello,

The GridView has the ElementExporting event allowing user to customize the element being exported and/or take other actions.

Apparently sometimes the custom-formatted row cell values assigned to the GridViewElementExportingEventArgs.Value property in the handler of such event are dropped and the corresponding cells display as blank in the exported Excel doc. The examination of generated HTML file confirms that the values are indeed missing. The error has irregular random nature; no pattern/condition for its occurrence has been found. Sometimes of two documents generated from the same grid with the same data one may have all cells populated, and another missing some values.

Is this issue known to Telerik? Are there any additional required actions (setting some flag, etc.) when overriding the Value property of the GridViewElementExportingEventArgs class with the custom value for the row cell?

Thanks,
Rob

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 21 Jan 2011, 10:22 AM
Hi Rob,

Actually we are not aware of such issue. It sounds very weird. You do not need to set any flags or something, just setting e.Value = your_data should be enough.
Still, can you paste here your code so we can have a better idea.
How many rows does the gridview have?


All the best,
Veselin Vasilev
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Srinivas
Top achievements
Rank 1
answered on 25 Dec 2013, 09:07 PM


Hi ,
Am using a RadGridview control to populate my data and using the ElementExporting event to customize the data while exporting to Excel.

My customization need goes like, I want to add some metadata(some info the grid like report name, date generated, owner etc , at the top A1 cell ) to the grid data that is getting exporting . beneat that my actual grid data should be shown, and it should be sorted as my need.
I could able to append the metadata using the

grdRiskClarityReport.Export(stream,

new GridViewExportOptions()

{

Format=

ExportFormat.Html,

ShowColumnHeaders =

true,

ShowColumnFooters =

true,

ShowGroupFooters =

false,

 

});


and my event goes like this,

private void grdRiskClarityReport_ElementExported(object sender, GridViewElementExportedEventArgs e)

{

 

if (e.Element == ExportElement.HeaderCell && temp== 0)

{

 

// if (obj != null)

{

e.Writer.Write(

String.Format(@"<tr><td style=""background-color:#CCC;"" colspan=""{0}"">","dfdfd"));

e.Writer.Write(

String.Format(@"<b>Proposal Name:</b> {0} <br />", "dfdfd")); //need to input properdata

e.Writer.Write(

String.Format(@"<b>Proposal Status:</b> {0} <br />", "dfdfd"));

e.Writer.Write(

"</td></tr>");

temp = 1;

// using the restrict the metadata to the first cell

}

}

}



Could you please provide me a sample in wpf version that serves my need ?


Thanks in advance,
Srinivas J







0
Yoan
Telerik team
answered on 30 Dec 2013, 02:49 PM
Hello Srinivas,

I have just replied to the other thread on the same topic.


Regards,
Yoan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Rob
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Srinivas
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or