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

GirdView Export to Exel with Dynamic Data Binding

3 Answers 67 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 24 Oct 2012, 08:16 PM
I have a RadGridView that I set the datasource at run time.  When I export it all the rows that are visible on the screen export fine, however the ones you can't see the excel row height is 3.75 pixels.  (See attached screen shot)  How do I get the export to export the correct format of all rows not just the ones visible?  One other side note is if I scroll through the list and then export it exports correctly. 

this.tSQL = "EXEC dbo.GetDetailsForCodeType '" + strSelectedCode + "','" + strSelectedCodeType + "'";
DataTable dtMarketDetails = this.da.GetDataTable(this.tSQL);
this.dgMarketDetails.DataSource = dtMarketDetails;

As a test I setup another GridView and pre set the data source and that exports just fine. 

3 Answers, 1 is accepted

Sort by
0
Scott
Top achievements
Rank 1
answered on 25 Oct 2012, 07:45 PM

Additional Information: I am trying to use one grid to display two possible sets of data depending on what the user selects.  One has about 6 columns and the other has about 12 columns.  I set it up to be pre-databound to the 6 column dataset, I then change the datasource at runtime.  If I open the form and do an excel export it exports fine.  However if I open the form and toggle the other dataset and then back again it exports only the rows visible and the rest are collapsed.  I take it there is a setting I am losing when the datasource of the control and its column contents change.  Any help is appreciated.

 

Thanks

0
Scott
Top achievements
Rank 1
answered on 25 Oct 2012, 08:07 PM
The solution to the issue is make sure and turn off AutoSizeRow and when you load and/or change the data source set the row and header height manually like this:

this.dgMarketDetails.TableElement.TableHeaderHeight = 20;
this.dgMarketDetails.TableElement.RowHeight = 20;
0
Ivan Petrov
Telerik team
answered on 29 Oct 2012, 02:45 PM
Hi Scott,

Thank you for writing.

I am glad you have found a solution to your problem. Nevertheless, we would like to investigate the issue you have experienced further. I tried to reproduce the issue, but I was not able to. I would kindly ask you to send me a sample project where you can reproduce the issue so we can find the cause of it.

Looking forward to your reply.

 

All the best,
Ivan Petrov
the Telerik team
Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
GridView
Asked by
Scott
Top achievements
Rank 1
Answers by
Scott
Top achievements
Rank 1
Ivan Petrov
Telerik team
Share this question
or