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