Hello Suchitra,
If you are trying to give an option of downloading an Office document then you can use the below code set.
'Clear the buffer and headers so that we can generate the office document
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.Buffer = True
HttpContext.Current.Response.Charset = ""
If _outputContentType = outputType.Excel Then
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" & _outputFileName)
Else
HttpContext.Current.Response.ContentType = "application/msword"
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" & _outputFileName)
End If
And then use the Response.Write method to write anything you wish.. I mean you can even download your .NET controls data. Ex. for grid you can use
Dim stringWrite As StringWriter = New StringWriter
Dim htmlWrite As Html32TextWriter = New Html32TextWriter(stringWrite)
Response.Write("<center><h1>Page Level Heading</h1></center>")
grdTest.RenderControl(htmlWrite)
Thanks,
Ravi
Su_ma_2011, if this helps please login to Mark As Answer. | Alert Moderator