tariqi 0 Newbie Poster

when i try to run the procedure below to export the gridview1 to msword,nothing appears on the document except tags <div> </div>.anyone knows what i might be doing wrong?

Public Overloads Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
        ' Verifies that the control is rendered 
    End Sub


    Protected Sub ButtonExport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonExport.Click
        Response.Clear()
        Response.Buffer = True
        Response.AddHeader("content-disposition", "attachment;filename=HoursExport.doc")
        Response.Charset = ""
        Response.ContentType = "application/vnd.msword"
        Dim sw As New StringWriter()
        Dim hw As New HtmlTextWriter(sw)
        GridView1.AllowPaging = False
        GridView1.DataBind()
        GridView1.RenderControl(hw)
        Response.Output.Write(sw.ToString())
        Response.Flush()
        Response.[End]()

   End Sub

any assistance will be appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.