Export to excel !!

  • Thread starter Thread starter amitmnagarwal
  • Start date Start date
A

amitmnagarwal

I have a page where i export to excel the content of Page 1

following code is written on page 2 to generate the excel

Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition", "attachment;
filename=dynamic.xls")

Now i on page 2 some db operation happens, so that data on page 1
should refresh which has datagrid.

i am unable to refresh the data on page1

please guide
 
first of all thanks for the reply

Page 1 : fetches data from the database and assigns to a session object
which is accessed in page 2 for generating excel.
This data is bound to a datagrid on page 1.


page 2 is used so that in excel there is only data and not the other
controls which are there on page 2.

What i am trying currently is doing server.transfer to the same page1
so that page 1 has fresh data and then redirecting to page2 to generate
the excel.

lets see
plz reply
 
first of all thanks for the reply

Page 1 : fetches data from the database and assigns to a session object
which is accessed in page 2 for generating excel.
This data is bound to a datagrid on page 1.


page 2 is used so that in excel there is only data and not the other
controls which are there on page 2.

What i am trying currently is doing server.transfer to the same page1
so that page 1 has fresh data and then redirecting to page2 to generate
the excel.
OK lets see if this is what you want to do.

1 - page 1's data source is some db container
2 - page 2 puts the data into an Excel spreadsheet
3 - page 2 lets the user modify the data w/out writing the changes to
the database
4 - when page 1 gets reloaded its datasource should be the Excel doc
and not the original db container.

Does the problem involve moving the data from step 3 to step 4? If so
you might consider adding page 3 to display the temporary data and use
a cross-page post to let page 3 access page 2's data.

regards
A.G.
 
Back
Top