Last post Oct 04, 2006 04:43 PM by jramsey
Oct 04, 2006 04:43 PM|jramsey|LINK
Hey all... I hope this helps someone else out there, because I know that I had trouble trying to get this to work like I wanted to. What I was trying to do was create an order confirmation document of all my data, but I didn't want the user to see the gridview.
So what I did was create my gridview as though I was going to display it will my SQLDataSource and all my columns and then I hid it. Then in the code behind of the button the customer clicked I put this data in it.
If GridView1.Visible = False And GridView2.Visible = False And GridView3.Visible = False And GridView4.Visible = False And _
Panel3.Visible = False And Label3.Visible = False And Label4.Visible = False And Label5.Visible = False And _
Label6.Visible = False Then
GridView1.Visible = True
GridView2.Visible = True
GridView3.Visible = True
GridView4.Visible = True
Panel3.Visible = True
Label3.Visible = True
Label4.Visible = True
Label5.Visible = True
Label6.Visible = True
Response.AddHeader("content-disposition", "attachment;filename=Order Confirmation.html")
Response.Charset = ""
Response.ContentType = "application/vnd.html"
Dim stringWrite As System.IO.StringWriter = New System.IO.StringWriter
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite)
Hope it helps. I also formated my gridviews to the way I needed them to be.