Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
468 views
we are having an application with large number of data.

while exporting the data from rad grid to excel format we are getting the error :
Exception type: OutOfMemoryException
the Rad Grid contains the 25 columns and nearly 35,000 rows

there is one aspx page on that page load the data will fetch into the RadGrid and then the data will export to Excel or CSV
i pasted the HTML and cs code

can you please assist us on this
<telerik:RadGrid ID="radGrid" runat="server" Visible="false" AutoGenerateColumns="false" OnGridExporting="radGrid_GridExporting"
    OnExcelExportCellFormatting="RadGrid1_ExcelExportCellFormatting">
     <ExportSettings HideStructureColumns="true" />

       </telerik:RadGrid>


the .CS  Code :

protected void Page_Load(object sender, EventArgs e)
{
        if (Request.QueryString["downloadoption"] != null)
         {
              LoadData();
          }
}


 private void LoadData()
        {
            Logger.LogInformation("Start", "btnSaveAs_Click", "DownloadFormat");
            if (Request.QueryString["ReportPagerName"] != null)
            {
                ReportPager = Request.QueryString["ReportPagerName"];
            }
            if (Session[ReportPager] != null)
            {
                int reportIntId = 0;
                Int32.TryParse(Request.QueryString[ReportID], out reportIntId);
                //string reportID = Request.QueryString[ReportID];
                this.CheckDataAccess(DataAccessType.Report, null, null, null, null, null, null, null, reportIntId);
                if (!IsTransactionDetailsPage(reportIntId))
                {
                    reportPager = (ReportPager)Session[ReportPager];
                    AddColumnsToGrid();
                    SetExportSettings();
                    BindDataTable();
                }
                else
                {
                    if (Session["TransactionDetails"] != null)
                    {
                        DataTable dt = (DataTable)Session["TransactionDetails"];
                        this.radGrid.MasterTableView.Columns.Clear();
                        foreach (DataColumn dc in dt.Columns)
                        {

                            GridBoundColumn gbc1 = new GridBoundColumn();
                            gbc1.DataField = dc.ColumnName;
                            gbc1.HeaderText = string.Empty;
                            this.radGrid.MasterTableView.Columns.Add(gbc1);
                        }

                        this.radGrid.DataSource = dt;
                        this.radGrid.DataBind();
                    }
                }

                DownloadDataGrid();
            }
            Logger.LogInformation("End", "btnSaveAs_Click", "DownloadFormat");
        }

private void AddColumnsToGrid()
        {
            Logger.LogInformation("Start", "AddColumnsToGrid", "DownloadFormat");

            this.radGrid.MasterTableView.Columns.Clear();
            foreach (GridField entry in reportPager.ColumnDictionary.Values)
            {
                if (entry.IsDisplayField)
                {
                    GridBoundColumn gbc1 = new GridBoundColumn();
                    gbc1.DataField = entry.DataField;
                    gbc1.HeaderText = entry.HeaderText;
                    this.radGrid.MasterTableView.Columns.Add(gbc1);
                }
            }

            Logger.LogInformation("End", "AddColumnsToGrid", "DownloadFormat");
        }


private void SetExportSettings()
        {
            Logger.LogInformation("Start", "SetExportSettings", "DownloadFormat");

            this.radGrid.ExportSettings.ExportOnlyData = true;
            this.radGrid.ExportSettings.IgnorePaging = true;
            this.radGrid.ExportSettings.OpenInNewWindow = true;
            this.radGrid.ExportSettings.FileName = ConfigurationManager.AppSettings["DownloadDataFileName"];

            Logger.LogInformation("End", "SetExportSettings", "DownloadFormat");
        }



private void BindDataTable()
        {
            Logger.LogInformation("Start", "BindDataTable", "DownloadFormat");

            this.reportPager.StartRow = 1;
            this.reportPager.EndRow = this.reportPager.GetRowCount();
            DataTable dt;
            //Excel
            if (Request.QueryString["downloadoption"].ToString() == "EXCEL")
                dt = this.reportPager.GetDataTable(false, false);
            else
                dt = this.reportPager.GetDataTable(false);

            this.radGrid.DataSource = dt;
            this.radGrid.DataBind();

            Logger.LogInformation("End", "BindDataTable", "DownloadFormat");
        }



private void DownloadDataGrid()
        {
            Logger.LogInformation("Start", "DownloadData", "DownloadFormat");
            this.radGrid.Visible = true;
            //CSV
            if (Request.QueryString["downloadoption"].ToString() == "CSV")
            {
                //if (SelRadioButtonList1.SelectedItem.Text == SelRadioButtonList1.Items[2].Text){

                this.SetCSVDelimiter();
                this.radGrid.MasterTableView.ExportToCSV();
            }
            //Excel
            else if (Request.QueryString["downloadoption"].ToString() == "EXCEL")
            {
                //else if (SelRadioButtonList1.SelectedItem.Text == SelRadioButtonList1.Items[0].Text)
                //{
                this.radGrid.MasterTableView.ExportToExcel();
            }
}


protected void radGrid_GridExporting(object source, GridExportingArgs e)
        {
            Logger.LogInformation("Start", "radGrid_GridExporting", "DownloadFormat");
            Response.ClearContent();
            Response.ClearHeaders();
            Response.Clear();
            Response.BufferOutput = true;
            if (e.ExportType == ExportType.Excel || e.ExportType == ExportType.Csv)
            {
                string filename = radGrid.ExportSettings.FileName;
                string fileExtension = radGrid.ExportSettings.Excel.FileExtension;
                if (e.ExportType == ExportType.Csv)
                    fileExtension = radGrid.ExportSettings.Csv.FileExtension;

                this.Response.AddHeader("Content-Disposition", "attachment;filename=\"" + filename + "." + fileExtension + "\"");

                if (e.ExportType == ExportType.Excel)
                {

                    //specify the number decimal separator and group separator being used.
                    string css = "<style type='text/css'><!--table {mso-displayed-decimal-separator:'\\" + Thread.CurrentThread.CurrentUICulture.NumberFormat.NumberDecimalSeparator;
                    css += "'; mso-displayed-thousand-separator:'\\" + Thread.CurrentThread.CurrentUICulture.NumberFormat.NumberGroupSeparator + "';} ";
                    css += this.AddDateFormatCSSClass();
                    css += "--> </style>";
                    //css += @"<script type=""text/javascript"" language=""javascript"">window.opener.Invoked();</script>";
                    e.ExportOutput = e.ExportOutput.Replace("</head>", css + "</head>");
                }
            }
            if (Request.QueryString["downloadoption"].ToString() == "CSV")
            {

                Response.ContentType = "application/octet-stream";
                Response.AddHeader("Content-Type", "text/csv");
                Response.BinaryWrite(new UnicodeEncoding().GetBytes(e.ExportOutput));
                Response.Flush();
                Response.End();
            }
            Logger.LogInformation("End", "radGrid_GridExporting", "DownloadFormat");

        }


James
Top achievements
Rank 2
 answered on 09 Feb 2015
1 answer
366 views
Hello Team,

I am using Rad grid, that is having more then 100000 records with 70 columns, 

I tried with even 10000 records only to check export issues but, Export to excel is not working, it slows down the page, and after waiting for 20 mins, its still not exporting the data.

Can anyone help me out with this?

Thanks and Regards,
Ruchi Patel

Pavlina
Telerik team
 answered on 09 Feb 2015
2 answers
105 views
Hello Team ,

I am using the Telerik RadAsyncUpload , where I am client facing the problem during the upload, yellow indicator is not getting turn into green during file browse.
and I am getting stuck on upload.

Please do help to rid this issue, as it is very important for business.
I have attached the screen shot
Boyan Dimitrov
Telerik team
 answered on 09 Feb 2015
3 answers
275 views
Hi there,

I was wondering if you could tell me whether there are any plans to create a panelbar that expands horizontally - my thinking is an accordion-style menu capability where the tabs (vertical) slide the panels out along the x axis such as here:


(I realise that one is flash-based, but you get the idea!)
Boyan Dimitrov
Telerik team
 answered on 09 Feb 2015
2 answers
78 views
Hi mates,

I have a radgrid and a external textbox and button to search specifics rows in the radgrid. Basically I change the SelectCommand of the RadGrid DataSource when I use the search button.
 
The first column of the radgrid is the following:

<telerik:GridTemplateColumn UniqueName="EditarEstado" ItemStyle-HorizontalAlign="Center" AutoPostBackOnFilter="false">
    <HeaderStyle Width="50px" />
    <ItemTemplate>
          <asp:ImageButton ID="btnEditarEstado" CommandName="Edit" runat="server" ImageUrl="~/img/buttons/edit.png"
          CommandArgument='<%# Eval("id") %>' ToolTip="Modificar" />
    </ItemTemplate>
</telerik:GridTemplateColumn>

If I search an specific row using the textbox and the search button, the row is showed successfully in the radgrid. The issue happens if I try to edit that row using the btnEditarEstado ImageButton. When I clic on it, autopostback is executed and the default SelectCommand of the radgrid datasource is set, so, it's like if I try to edit the first row and not the row that I searched.

How could I edit the selected row and not the default first one, please?

Please, let me know if you have any problem to understand my problem.

Thanks a lot in advance.

Cheers.
davortsan
Top achievements
Rank 1
 answered on 09 Feb 2015
1 answer
86 views
Hi, 

I have a RadGrid  with height=300px, it does not  adjust it's height when groups are collapsed. I would like it's height  to be 300px or less and show scrollbars when needed. When groups are collapsed, it shows whitespace as seen in given image to fill grid height. How can I adjust grid height when groups are collapsed?


I want grid height to adjust like in this demo.
http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/grouping/grouping/defaultcs.aspx

Thanks,
Prava
Pavlina
Telerik team
 answered on 09 Feb 2015
1 answer
124 views
I have a RadRating on a page that if clicked runs javascript that opens a modal.  The modal pop-up contains a "separate" RadRating module.  Everything work fine until the form on the modal popup is submitted.  This asp:Button-based submission saves to db; generates a postback; and runs javascript that hides the modal.  

What javascript do I need to use to reload my RadRating after postback from a Foundation 5 reveal modal popup? (more about modal http://foundation.zurb.com/docs/components/reveal.html)


var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
      // What do I put here to re-initialize the RadRating on the main page? 
});
Slav
Telerik team
 answered on 09 Feb 2015
2 answers
80 views
We're trying to work around a possible network/browser issue at a client site. Occasionally the on demand web service call is failing. The request the browser  makes is completely empty. Any subsequent call succeeds. Is there any way to retry the web service call up to 3 times before returning an error? It's easy enough in jQuery, but I can't find how to manage the calls myself with the RadComboBox

Thanks.
Fadi
Top achievements
Rank 1
Veteran
 answered on 09 Feb 2015
3 answers
225 views
For the love of HTML5 and push for mobile compatibility please modify radnumerictextbox to allow for HTML 5 numeric input type. For years I have seen all the responses from Telerik to just use the RadTextBox. The radnumerictextbox has better support for numbers, yet lacks the most basic COOL feature for mobile. Inputtype = number.
Maria Ilieva
Telerik team
 answered on 09 Feb 2015
3 answers
248 views
1. How to add Caption or Title, when user export to excel.
2. Display row count for aggregated rows along with aggregate value.

Attached is the sample snapshot for further clarification.
Maria Ilieva
Telerik team
 answered on 09 Feb 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?