westdh
asked on
export gridvie to exle
How do I export a grid to excel
Hi
Bellow url Give some information
http://www.codeproject.com/KB/office/office_automation.aspx
Bellow url give sample code
http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html
http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp2_dc11032006003657AM/exportxl_asp2_dc.aspx
Bellow url Give some information
http://www.codeproject.com/KB/office/office_automation.aspx
Bellow url give sample code
http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html
http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp2_dc11032006003657AM/exportxl_asp2_dc.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi..
Create a Seperate Class File.. and just call the function in your code behind
i have mentioned the Class file coding in the Below URL of Experts-Exchange..
hope this will help you surely..
https://www.experts-exchange.com/questions/24844004/export-to-excel.html
Create a Seperate Class File.. and just call the function in your code behind
i have mentioned the Class file coding in the Below URL of Experts-Exchange..
hope this will help you surely..
https://www.experts-exchange.com/questions/24844004/export-to-excel.html
try following code ..
Public Shared Sub ExportGridToExcel(ByVal grdGridView As GridView, ByVal fileName As String)
Current.Response.Clear()
Current.Response.AddHeader ("content- dispositio n", String.Format("attachment; filename={ 0}.xls", fileName))
Current.Response.Charset = ""
' Current.Response.ContentTy pe = "application/vnd.xls";
Dim stringWrite As New StringWriter()
Dim htmlWrite As New HtmlTextWriter(stringWrite )
grdGridView.RenderControl( htmlWrite)
Current.Response.Write(str ingWrite.T oString())
Current.Response.Flush()
Current.Response.[End]()
End Sub
and just pass the grid name and the filename thats all..
Public Shared Sub ExportGridToExcel(ByVal grdGridView As GridView, ByVal fileName As String)
Current.Response.Clear()
Current.Response.AddHeader
Current.Response.Charset = ""
' Current.Response.ContentTy
Dim stringWrite As New StringWriter()
Dim htmlWrite As New HtmlTextWriter(stringWrite
grdGridView.RenderControl(
Current.Response.Write(str
Current.Response.Flush()
Current.Response.[End]()
End Sub
and just pass the grid name and the filename thats all..
http://aspnetlibrary.com/articledetails.aspx?article=How-to-export-a-GridView-to-Excel