Hi Team,
Good Day,
I have a very serious problem with one of my page in the project...
I have added new button named Export To Excel which will export the entire data(543KB) or lesser data depend upon search criteria from the it will export the data to excel file from the grid view...
as soon as I m clicking on this button my Excel memory usage in the task manager goes to 75+ MB and suddenly my excel files got crash...
can u please help me....
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("UserName") = "" Then
Response.Write("Your session has expired.Please login again")
Response.End()
End If
If (Page.IsPostBack = False) Then
mstrProjects = Request.QueryString("Project")
mstrCustomer = Request.QueryString("Customer")
mstrPONO = Request.QueryString("PONo")
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment; filename=AllPurchaseOrder.xls")
getExcelList()
End If
Private Sub getExcelList()
Dim ldsPurchaseOrder As DataSet
Dim marrParm() As SqlParameter
Dim mdslst As New DataSet
Try
marrParm = New SqlParameter(2) {}
marrParm(0) = New SqlParameter("@Customer", SqlDbType.VarChar, 100)
marrParm(0).Value = IIf(mstrCustomer = "All" Or mstrCustomer = "0", DBNull.Value, mstrCustomer)
marrParm(1) = New SqlParameter("@Projects", SqlDbType.VarChar, 100)
marrParm(1).Value = IIf(mstrProjects = "All" Or mstrProjects = "0", DBNull.Value, mstrProjects)
marrParm(2) = New SqlParameter("@PONO", SqlDbType.VarChar, 50)
marrParm(2).Value = IIf(mstrPONO = "", DBNull.Value, mstrPONO)
With mObjBll
.ProcedureName = "getPOinexcel"
.ParametersList = marrParm
ldsPurchaseOrder = .GetList()
If .IsRedirect = False Then
Response.Write(" Error: getPOinexcel " & .ErrorMessage)
Exit Try
Else
mdslst = ldsPurchaseOrder
End If
End With
If ldsPurchaseOrder.Tables(0).Rows.Count = 0 Then
Response.Write("<font color="red">No Records Found.</font>")
End If
Response.Write("")
gvPOList.DataSource = ldsPurchaseOrder
gvPOList.DataBind()
Friends if I m commenting out the line
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment; filename=AllPurchaseOrder.xls")
getExcelList()
I am getting data on a web page with in a 10 second but same is not working for the excel files....
please help me....