Last post May 07, 2012 06:51 PM by Nasser Malik
May 07, 2012 10:09 AM|mnmhemaj|LINK
I need to export both gridview data and data from other textbox and label controls in vb.net form to Excel.
I can export data from Gridview. But I don't know how to send other data simultaneously.
May 07, 2012 10:18 AM|santosh.jagdale|LINK
Private Sub ExportToExcel(ByVal strFileName As String, ByVal dg As GridView)
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Me.EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter
Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWriter(oStringWriter)
May 07, 2012 10:38 AM|mnmhemaj|LINK
Ypu code is to export data from gridview to excel. I need code to export data from other controls too. For example I have Item Number, Revision and Description values as Labels. How can I get these values to excel?
May 07, 2012 11:30 AM|ramiramilu|LINK
you can construct HTML out of the data which you want to render to excel and then set the same on Response object and send it to client...it will work...
May 07, 2012 11:48 AM|mnmhemaj|LINK
Can you please explain it in detail or with a small example?
May 07, 2012 06:51 PM|Nasser Malik|LINK
see .. it's in csharp but you can easily convert to vb