Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 320993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:48:17+00:00 2026-05-12T08:48:17+00:00

I have a need to export the contents in a ComponentArt Grid into a

  • 0

I have a need to export the contents in a ComponentArt Grid into a file, preferably excel in csv format.

I was wondering if anyone had any ideas how to best approach this task. At the moment we have the grid being populated with data, and using client templating some minor manipulation is being performed before it is displayed to the user.

An example of a template that is applied is:

<ComponentArt:ClientTemplate Id="PostTemplate">
   ## DataItem.GetMember("LastPostBy").Value ##<br />## DataItem.GetMember("LastPostDate").Value ##
</ComponentArt:ClientTemplate>

Where the column definitions are:

<ComponentArt:GridColumn Width="140" HeadingText="Last Post By " DataCellClientTemplateId="PostTemplate" />
<ComponentArt:GridColumn DataField="LastPostBy" Visible="false" />
<ComponentArt:GridColumn DataField="LastPostDate" Visible="false" />

So when the grid is exported I would like the file to contain what is in the grid at the moment of export including any templated changes that may be visible if possible.

Thank you in advance for your assistance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:48:17+00:00Added an answer on May 12, 2026 at 8:48 am

    You cannot export the Web.UI Grid directly using RenderControl into a text writer. Instead, you should convert its data into another form (such as the ASP DataGrid) and export that instead.

    The reason behind this is that the Web.UI Grid’s structure is build dynamically on the client — it’s passed from server to client as a bunch of XML and array data, which is converted into the tables and divs that you see in the window.

    As a result you’ll want to perform the export on the Grid’s datasource, and then analyze the client templates to replicate what they would change when built dynamically on the client.

    The following is a short example of how to export the CA grid it into excel:

    public void ExportDataSetToExcel() {
        object theColl = gridEmployee.DataSource; //just set this as your grid's datasource.
        GridView excelGrid = new GridView();
        excelGrid.DataSource = theColl;
        excelGrid.ID = "Export";
        excelGrid.DataBind();
        excelGrid.AutoGenerateColumns = true;
    
        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "application/vnd.ms-excel";
        Response.AddHeader("content-disposition", "attachment;filename=RegainExport.xls");
        Response.Charset = "";
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        System.IO.StringWriter stringWrite = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
        excelGrid.RenderControl(htmlWrite);
        Response.Write(stringWrite.ToString());
        Response.End();
    }
    

    So before binding the datasource of the GridView you will want to perform the ClientTemplate replication.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a test database that I need to export into our client's test
I have received a content export of a MOSS 2007 site which I need
I have the need to copy the entire contents of a directory on a
Hi i have my text file in this format **4 1250000209852 01 XXXX XXXX
I have created a program that decrypts whats stored in a export file from
I need to transform a lot of XML files (Fedora export) into a different
I have the below vba macro to Export the selected cells into a text
I have a grid of data that I want to export to RTF, PDF
I need expert advice here... I have run into the strangest problem in my
i need to export a pages to pdf, the pages will have grids on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.