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 7732641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:46:54+00:00 2026-06-01T06:46:54+00:00

So I have a GridView in my ASPX page. When I click <asp:Button id=btnBindIt

  • 0

So I have a GridView in my ASPX page.

When I click <asp:Button id="btnBindIt" runat="server" /> it binds a datatable as follows:

theDataTable = GetAllTheRecords();
gvTheGridView.DataSource = theDataTable;
gvTheGridView.DataBind();

Note: theDataTable is a member

private DataTable theDataTable;

This works as expected.

Now, after the GridView is displayed nicely, I want to export the data to CSV, so I now click the <asp:Button id="btnExportIt" runat="server" /> which runs the code:

exportToCsv(theDataTable);

but theDataTable is null.

So I tried

exportToCsv(gvTheGridView.DataSource)

Which is also null.

What’s the standard way of persisting this data? I don’t really want to hit the DB again as it’s quite a long SPROC and the user has already waited once.

Thanks in advance!

  • 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-06-01T06:46:56+00:00Added an answer on June 1, 2026 at 6:46 am

    Thanks for the answers everyone.

    I steer clear of putting stuff into the VeiwState or session unnecessarily, so I think the best way to persist this data is to Cache it.

    I think the MemoryCache is the most appropriate place for this, is is how I ended up implementing it.

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

Sidebar

Related Questions

In my .aspx page, I have an <asp:GridView runat=server ID=CustomerGridView> control which I bind
i am having a asp.net and c#.net application and i have a page gridview.aspx
I have an ASP.Net GridView control on an ASPX page hosted on a SharePoint
I have this code in .aspx page <gridview ..... <columns> ............ ........... <asp:templatefield Visible=true
I have asp.net's .aspx page. that have GridView let say GridViewParent and Each row
I have a GridView on a .aspx page with a hidden column which has
Hello mates i have a page View All Applicants.aspx with gridview and a link
Basically I have a gridview that I page through the server instead of in
I have an aspx page with a gridview. In my page load event, I
I am using two gridview controls in my aspx page. And I have a

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.