Export to Excel from GV on a panel (modal popup extender)

Discussion in 'ASP .Net Building Controls' started by jonefer, May 16, 2008.

  1. jonefer

    jonefer Guest

    If I want to export an Excel from a gridview
    I normally use these two procedures... but I get a render error perhaps due
    to the fact that this particular gridview is on a panel triggered by a modal
    popup extender:

    What should I modify or add?

    'this line is to help the Export to Excel control
    Public Overloads Overrides Sub VerifyRenderingInServerForm(ByVal control As
    Control)
    End Sub


    Protected Sub cmdExcelExport_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles cmdExcelExport.Click
    Response.Clear()
    Response.AddHeader("content-disposition",
    "attachment;filename=FileName.xls")
    Response.Charset = ""
    Response.ContentType = "application/vnd.xls"
    Dim stringWrite As System.IO.StringWriter = New System.IO.StringWriter
    Dim htmlWrite As System.Web.UI.HtmlTextWriter = New
    HtmlTextWriter(stringWrite)
    gvActionList.RenderControl(htmlWrite)
    Response.Write(stringWrite.ToString)
    Response.End()

    End Sub
     
    jonefer, May 16, 2008
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.