This is a migrated thread and some comments may be shown as answers.

[Solved] RadComboBox quits responding after Excel export

3 Answers 134 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Andrew E.
Top achievements
Rank 1
Andrew E. asked on 30 Oct 2009, 12:20 PM
I have several Rad Controls on a Web form including a RadComboBox that initially works correctly.  After clicking a button to export data to an excel spreadsheet the RadComboBox quits responding.  Clicking the arrow to dropdown the list does nothing while all other controls appear to work just fine.

The code I am useing for the expot is as follows:

            DataView detailDT = (DataView)detailGridView.DataSource;

            string filename = String.Format("{0}.csv", "ExportDetails");

            Response.Clear();
            Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
            Response.Charset = "";
            Response.ContentType = "application/vnd.xls";

            StringWriter stringWriter = new StringWriter();
            ArrayList colHeaders = new ArrayList();
            ArrayList dataRow = new ArrayList();

            //handle forcing Excel from treating file as an "sylk" file
            stringWriter.Write("  ");

            foreach (DataControlField dataCol in detailGridView.Columns)
            {
                colHeaders.Add(dataCol.HeaderText);
            }

            stringWriter.WriteLine(string.Join(",", (string[])colHeaders.ToArray(typeof(string))));

            foreach (DataRow dr in detailDT.Table.Rows)
            {
                foreach (DataColumn dataCol in detailDT.Table.Columns)
                {
                    dataRow.Add(dr[dataCol]);
                }

                stringWriter.WriteLine(string.Join(",", (string[])dataRow.ToArray(typeof(string))));

                dataRow.Clear();
            }

            Response.Write(stringWriter.ToString());
            Response.End();


Thanks

3 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 04 Nov 2009, 01:05 PM
Hello Andrew E.,

I tried reproducing this issue with a simple page without success.

Can you please see the attached code and let me know if I have missed something?

Sincerely yours,
Simon
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Andrew E.
Top achievements
Rank 1
answered on 04 Nov 2009, 02:03 PM
That did not fix the issue for me.  I created a new project, imported the file you sent and ran it.  Originally the Dropdown worked but once I clicked the Export button the Dropdown stopped working. 

FYI
  • I had to reference the Telerik.Web.UI.dll that we have (2008.1.515.20). 

 

I can be reached by phone if necessary - 412-808-1120

Thanks

Andrew E. Kirin
0
Simon
Telerik team
answered on 09 Nov 2009, 06:26 PM
Hi Andrew E.,

The version you are using is almost an year and a half old and this issue has been fixed since then.

With this version you could work around the issue by handling the Click event of the Export button and overriding a method of RadComboBox as shown below:

function onExport() {
    $find("RadComboBox1").isInPostBack = false;
};
 
Sys.Application.add_init(function() {
    Telerik.Web.UI.RadComboBox.prototype.setIsInPostBack = function(value) {
    if (value) {
        this._isInPostBack = this.isInPostBack;
        this.isInPostBack = true;
    }
    };
});

Note: Please put the script after the ScriptManager on your page.

Sincerely yours,
Simon
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox
Asked by
Andrew E.
Top achievements
Rank 1
Answers by
Simon
Telerik team
Andrew E.
Top achievements
Rank 1
Share this question
or