Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > Exporting to Excel Show and Hide column in row

Not answered Exporting to Excel Show and Hide column in row

Feed from this thread
  • Mike Master avatar

    Posted on Feb 23, 2012 (permalink)

    I have a RadGrid that shows or hides data in a certain row based on some logic in my RadGrid1_ItemDataBound method. 

    I am trying to show the column and only certain rows on the export.

    RadGrid
    First Name   MVP
    Fred             Yes
    John             No
    Bill
    Stan             Yes
    Jack             Yes

    Export to Excel
    First Name   MVP
    Fred             Yes
    John             No
    Bill                Yes
    Stan             Yes
    Jack             Yes

    As you can see I can hide "Yes" in the codebehind of the RadGrid1_ItemDataBind method, but it appears in the Export.

    How can I get "Yes" to NOT appear in the export to excel?

    protected void ButtonExcel_Click(object sender, System.EventArgs e)
       {
          ConfigureExport();
          RadGrid Grid1 = (RadGrid)Page.Master.FindControl("Main").FindControl("RadGrid1");
          Grid1.MasterTableView.GetColumn("mvp").Display = true;
          // Logic here to hide certain data in the based on the MVP value
          Grid1.MasterTableView.ExportToExcel();
       }


    Reply

  • jumpstart Master avatar

    Posted on Feb 27, 2012 (permalink)

    Michael:

    Take a look at the Rad Grid Export to Excel issue forum thread. You should be able to modify the code provided by Shinu that uses the RadGrid_ExportCellFormatting event to conditionally hide column values in the export.

    Hope this helps!

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > Exporting to Excel Show and Hide column in row
Related resources for "Exporting to Excel Show and Hide column in row"

ASP.NET Grid Features  |  Documentation  |  Demos  |  Step-by-step Tutorial  ]