Last post Feb 29, 2008 01:43 PM by skynyrd
Jan 15, 2008 05:31 AM|dcallan|LINK
I've a dropdown with a couple of options in it, one of which calls a aspx page which contains the code below:
protected void Page_Load(object sender, EventArgs e)
Response.ContentType = "application/msexcel";
Response.AddHeader("Content-Disposition", "attachment; filename=ITDP-export.xls");
DataTable dt = BLL.GetAllITDPs();
if (dt.Rows.Count > 0)
GridView gv = new GridView();
gv.DataSource = dt;
The code itself works fine and when I select the export to excel function in the dropdown the excel opens in a new windows with all the correct data. The problem however relates to how if i then (immediately after exporting) press other buttons on the page
name submit and draft, the logic for the excel gets called again. Its like the excel logic overwrites the code behind logic for the standard buttons. Is there anything I can do to prevent this? Your help is as always much appreciated.
Jan 16, 2008 05:23 PM|abdulbq|LINK
have you checked if you have set autopostback property to true for the combo box?
Jan 18, 2008 07:18 AM|dcallan|LINK
hi there, yeah I got autopostback set to true on the dropdown. I lost for ideas to be honest. I think I would have got more responses where I posted this originally too. Excel to excel is mentioned a lot in 'web forms' and 'novice' boards.
Feb 26, 2008 09:17 AM|dcallan|LINK
Any ideas on this folks. Do I need to switch from a dropdown list to a link to open excelbased files without messing with the page handlers.
Feb 29, 2008 01:43 PM|skynyrd|LINK
Maybe you could use