Telerik,
I would like to export all data from my radgrid using CSV but its not working as expected.
I have added a CommandItemSettings tag for using the CSV export button on the Grid. When I click the button to export my current grid, the ItemCommand event is raised and I test for the following condition and my code is as follows:
Setting the following property, allows me to export just the one page, but by changing this value to true, I only export the Header Row!?
I also have an ItemDataBound event that is called where I format a TableCell's text property to be equal to that of a HiddenField inside of a TemplateColumn.
How can I export all the data in my grid to CSV?? So far I have only been able to export it for the first page. I need the option to export it for all pages.
I would like to export all data from my radgrid using CSV but its not working as expected.
I have added a CommandItemSettings tag for using the CSV export button on the Grid. When I click the button to export my current grid, the ItemCommand event is raised and I test for the following condition and my code is as follows:
protected void myGrid_ItemCommand(object sender, GridCommandEventArgs e){ if (e.CommandName == RadGrid.ExportToCsvCommandName) { IsExport = true; myGrid.ExportSettings.IgnorePaging = false; myGrid.MasterTableView.GetColumn("Activities").Visible = false; myGrid.MasterTableView.GetColumn("License").Visible = false; myGrid.MasterTableView.GetColumn("Delete").Visible = false; myGrid.MasterTableView.AllowPaging = false; } }Setting the following property, allows me to export just the one page, but by changing this value to true, I only export the Header Row!?
myGrid.ExportSettings.IgnorePaging = false;I also have an ItemDataBound event that is called where I format a TableCell's text property to be equal to that of a HiddenField inside of a TemplateColumn.
bool IsExport = false;protected void myGrid_ItemDataBound(object sender, GridItemEventArgs e){ //Fix TemplateColumn on Exporting if (IsExport && e.Item is GridEditableItem) { //Fix Template Column Text GridEditableItem item = e.Item as GridEditableItem; foreach (TableCell cell in item.Cells) { HiddenField field= (HiddenField)e.Item.FindControl("hdnField"); if (field != null) { cell.Text = field.Value; } } } }How can I export all the data in my grid to CSV?? So far I have only been able to export it for the first page. I need the option to export it for all pages.