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

[Solved] ExporttoExcel() in Radgrid not working

1 Answer 142 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raja Rajeswari Mohan Venkataraman
Top achievements
Rank 1
Raja Rajeswari Mohan Venkataraman asked on 14 Jan 2010, 04:34 PM
Hi,

I have a radgrid in my aspx page and Reports button in the page. I want to do exporttoexcel() on button click of Reports button.

The values for the grid are binded during page_load.

<

 

script type="text/javascript">

 

var

 

_selectedRow;

 

 

 

var rowindex;

 

 

function grdResult_RowSelected(sender, args)

 

{

_selectedRow = $get(args.get_id());

 

rowindex = _selectedRow.sectionRowIndex;

 

var myAppKey = "<%= hdnradGridClickedRowIndex.ClientID %>";

 

 

document.getElementById(myAppKey).value = rowindex;

}
</script>

<

 

telerik:RadGrid ID="grdResult" runat="server" Width="1198px"

 

 

AllowMultiRowSelection="True" AllowSorting="True" Height="552px" style="margin-right: 1px" >

 

 

 

 

<MasterTableView Width="100%">

 

 

<Columns>

 

 

<telerik:GridClientSelectColumn UniqueName="SEL" Text="SEL"></telerik:GridClientSelectColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

 

<ClientSettings>

 

 

<Scrolling AllowScroll="True" SaveScrollPosition="True"/>

 

 

<Resizing ClipCellContentOnResize="False" />

 

 

<Selecting AllowRowSelect="true" UseClientSelectColumnOnly="true" />

 

 

<ClientEvents OnRowContextMenu="grdResult_RowSelected" />

 

 

</ClientSettings>

 

</

 

telerik:RadGrid>

 


In my code behind I have the following code on Reports button click.

 

Private Sub btnReport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReport.Click

 

 

grdResult.ExportSettings.OpenInNewWindow = True

 

grdResult.ExportSettings.IgnorePaging =

True

 

grdResult.ExportSettings.Excel.Format = Telerik.Web.UI.GridExcelExportFormat.ExcelML

grdResult.MasterTableView.ExportToExcel()

 

End Sub

Please let me know what is wrong here. Exporttoexcel()  functionality is not working.

Thanks,
M.Raji

 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 14 Jan 2010, 05:08 PM
Hello Raja,

ExcelML format doesn't work properly with simple data-binding. Please switch to advanced data-binding or use a datasource control to address this problem.
Simple Data-binding
Advanced Data-binding
ExcelML export (notice the first "tip box")

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Raja Rajeswari Mohan Venkataraman
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or