Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Export to Excel and Navigating to other Page

Export to Excel and Navigating to other Page

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pravin_mun
    wrote on last edited by
    #1

    Hi Guys , Stuck up in small issue can u any one please help me out of this. I have exported a excel report as below. But last statement is not executing. After downloading it i want to navigate to other page, But it is throwing exception. I understood that i am clearing the HTTP Response. But can i cal one more HTTP?? or how can i navigate to other page.. Please help on this string attachment = "attachment; filename=Export.xls"; Response.ClearContent(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/ms-excel"; GridView1.RenderControl(htw); Response.Write(sw.ToString()); Response.End() Response.Redirect("Downloaded.aspx",false); [Problem][Exception]

    D R 2 Replies Last reply
    0
    • P pravin_mun

      Hi Guys , Stuck up in small issue can u any one please help me out of this. I have exported a excel report as below. But last statement is not executing. After downloading it i want to navigate to other page, But it is throwing exception. I understood that i am clearing the HTTP Response. But can i cal one more HTTP?? or how can i navigate to other page.. Please help on this string attachment = "attachment; filename=Export.xls"; Response.ClearContent(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/ms-excel"; GridView1.RenderControl(htw); Response.Write(sw.ToString()); Response.End() Response.Redirect("Downloaded.aspx",false); [Problem][Exception]

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Think about it. When you execute Response.End, that's it. There's nothing else being sent to the client. You cannot redirect a client after you call Response.End.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      1 Reply Last reply
      0
      • P pravin_mun

        Hi Guys , Stuck up in small issue can u any one please help me out of this. I have exported a excel report as below. But last statement is not executing. After downloading it i want to navigate to other page, But it is throwing exception. I understood that i am clearing the HTTP Response. But can i cal one more HTTP?? or how can i navigate to other page.. Please help on this string attachment = "attachment; filename=Export.xls"; Response.ClearContent(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/ms-excel"; GridView1.RenderControl(htw); Response.Write(sw.ToString()); Response.End() Response.Redirect("Downloaded.aspx",false); [Problem][Exception]

        R Offline
        R Offline
        RaviRanjanKr
        wrote on last edited by
        #3

        Always wrap your code in "pre" tag.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups