Hello,i have a question about exporting to excel,i have i Radgrid (include Client Select Column) when i export , it will export from Radgrid (include client select column),but i don't want to that,i want to only get data from radgrid ( not get cilent select column or other columns such as template column ....)
this's demo :
http://nguy-hiem.co.cc/share/demo.png
please help me,THANK
this's demo :
http://nguy-hiem.co.cc/share/demo.png
please help me,THANK
7 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 02 Jun 2011, 05:36 AM
Hello Trunghieu,
One suggestion to hide ClientSelectColumns/TemplateColumns when exporting to excel is by setting the ExportSettings as shown below which worked as expected in my end.
aspx:
Another approach to hide the Template Columns in the Export button click event before you export the grid to Word or Excel by setting the Display property as false.
RadGrid1.MasterTableView.GetColumn("ColumnUniqueName").Display = false;
Thanks,
Princy,
One suggestion to hide ClientSelectColumns/TemplateColumns when exporting to excel is by setting the ExportSettings as shown below which worked as expected in my end.
aspx:
<
ExportSettings
Excel-Format
=
"ExcelML"
ExportOnlyData
=
"true"
>
</
ExportSettings
>
Another approach to hide the Template Columns in the Export button click event before you export the grid to Word or Excel by setting the Display property as false.
RadGrid1.MasterTableView.GetColumn("ColumnUniqueName").Display = false;
Thanks,
Princy,
0

trunghieu
Top achievements
Rank 1
answered on 02 Jun 2011, 05:42 PM
Thank you,but now i have a problem,when i using ajax i can't export ? what should i do ?
THANK
THANK
0

Jayesh Goyani
Top achievements
Rank 2
answered on 02 Jun 2011, 07:03 PM
Hi,
If you used Asp:UpdatePanel Than follow below link.
- if u used defualt export button
http://www.telerik.com/community/code-library/aspnet-ajax/general/export-radgrid-content-to-excel-word-csv-pdf-with-ajax-enabled.aspx
- for your custom export button
http://www.telerik.com/community/forums/aspnet-ajax/grid/export-grid-within-updatepanel.aspx
http://www.telerik.com/help/aspnet-ajax/grid-export-with-ajax-enabled.html
If you used telerik:RadAjaxManager Than follow below link.
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/exporting/defaultcs.aspx
Thanks,
Jayesh Goyani
If you used Asp:UpdatePanel Than follow below link.
- if u used defualt export button
http://www.telerik.com/community/code-library/aspnet-ajax/general/export-radgrid-content-to-excel-word-csv-pdf-with-ajax-enabled.aspx
- for your custom export button
http://www.telerik.com/community/forums/aspnet-ajax/grid/export-grid-within-updatepanel.aspx
http://www.telerik.com/help/aspnet-ajax/grid-export-with-ajax-enabled.html
If you used telerik:RadAjaxManager Than follow below link.
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/exporting/defaultcs.aspx
Thanks,
Jayesh Goyani
0

trunghieu
Top achievements
Rank 1
answered on 09 Jun 2011, 08:32 AM
Thank you ! now i have a question,please help me
in this code,i want export to word from Radgrid2 (Radgrid2 into Radgrid1) , i using global variable Radgrid r and then i using event itemcommand (when i expanded) with code r = (RadGrid)((GridDataItem)e.Item).ChildItem.FindControl("RadGrid2");
finnaly in btnword_Click Event i using r.MasterTableView.ExportToWord() , but my code not run
Thanks !
Trung Hiếu
protected void btnword_Click(object sender, ImageClickEventArgs e)
{
r.MasterTableView.ExportToWord();
}
RadGrid r;
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
qt = new global::sieuthi.BUSINESS.B_quatang();
try
{
if (e.CommandName == RadGrid.ExpandCollapseCommandName)
{
r = (RadGrid)((GridDataItem)e.Item).ChildItem.FindControl("RadGrid2");
r.DataSource = qt.DanhSachDoiQua(makh.ToString());
r.DataBind();
}
lbloi.Text = "";
}
catch (Exception ex)
{
lbloi.Text = ex.Message;
}
}
finnaly in btnword_Click Event i using r.MasterTableView.ExportToWord() , but my code not run
(Object reference not set to an instance of an object.)
i don't know why ? please me helpThanks !
Trung Hiếu
0

trunghieu
Top achievements
Rank 1
answered on 10 Jun 2011, 03:27 PM
help me,please
0
Hello Trung,
Please try to set IgnorePaging and ExportOnlyData properties to false and let me know if the problem still persists.
Best regards,
Daniel
the Telerik team
Please try to set IgnorePaging and ExportOnlyData properties to false and let me know if the problem still persists.
Best regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

trunghieu
Top achievements
Rank 1
answered on 14 Jun 2011, 04:31 PM
Thank you,but i think,my problem to relate with global variable that's Radgrid r;
Thank,
Trung Hieu
Thank,
Trung Hieu