2 Replies - 7045 Views - Last Post: 09 October 2011 - 11:34 PM

#1 Demonic_Reaper  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 1
  • Joined: 05-April 11

Retain data in gridview

Posted 05 April 2011 - 03:10 AM

I'm making a page on which you can upload an excel file, and where that data gets copied to a datagrid beneath the fileupload tool.

The way I programmed it, is that the file you upload (Microsoft.Office.Interop.Excel), gets saved to my project folder, copied to the grid, then that file gets removed from the project and you get a "Save" button to sent this data to the DB.

All of this works, but since I have to pay attention to the layout of the site, I have to turn the Paging option (of my gridview) on.
Now, the problem with that is; when selecting another page, the grid has to read its data again; which isn't there anymore since I removed the xls-file from my project...

I was thinking about instead of removing the xls right after the data is loaded; to remove it when the user goes to another page, closes its browser, or tries to upload another excelfile; but I'm not sure what would be the best way to do this

(and also: what if the user's computer is turned off? the browser-close "event" never happened then, and the file would still be there?)



Any ideas?

Is This A Good Question/Topic? 1
  • +

Replies To: Retain data in gridview

#2 icarus1984  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 08-October 11

Re: Retain data in gridview

Posted 09 October 2011 - 12:17 PM

Why not turn paging off and place the gridview inside of a div? Using css, fix the size (width and height) of the div and set overflow to auto.

That way the entire Excel worksheet is visible to the user as long as they scroll.

This post has been edited by icarus1984: 09 October 2011 - 12:17 PM

Was This Post Helpful? 0
  • +
  • -

#3 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 107
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: Retain data in gridview

Posted 09 October 2011 - 11:34 PM

Another option you could do is to import the excel data directly to a table in your db and then read the data from your database in your gridview.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1