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

Problem with RadGrid and ExportToExcel in IE8 not in IE7

9 Answers 208 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christopher Svensson
Top achievements
Rank 1
Christopher Svensson asked on 31 May 2010, 04:30 PM
Hi!

My problem are that the first time I load the website the Grid shows all the rows with data correct.

Then I want to search for a specific name but it return rows that the grid doesn't show.

The count of Items and total pages are right.

In IE7 all works fine.

Can it be the Databind?

To another problem
 The export to excel function in grid doesn't work in IE8. 
This function work in IE7.

How can i solve this two problems?

Best Regards

Christopher Svensson
System Developer
atespintop.com

9 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 31 May 2010, 09:37 PM
Hello Christopher,

My problem are that the first time I load the website the Grid shows all the rows with data correct.
Then I want to search for a specific name but it return rows that the grid doesn't show.
Can you please provide some more details about this problem? I'm not sure that I understand you completely.

The export to excel function in grid doesn't work in IE8. 
This function work in IE7.
This is not a common problem so it is hard to guess what might cause it. I would appreciate if you could post your code or attach a runnable demo (in support ticket) so I can examine the problem locally.

Regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Christopher Svensson
Top achievements
Rank 1
answered on 01 Jun 2010, 09:12 AM
Hello Daniel!

Thanks for you reply so quick.

The first problem with the grid is when the website loads for the first time, all rows shows upp in the grid.
After I search  "Pro" for example there doesn't show any rows, but I can see there are 6 items in the grid that has the letters in the name.
I attached some files for you with the problem.

The code works for sure in IE7,and other browsers but not in IE8. Here is the code

protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!IsPostBack) 
            { 
                Session["DT_LEFT"] = null
                Session["DT_RIGHT"] = null
                Session["DT"] = null
                this.RadGrid1.MasterTableView.Columns.Clear(); 
                this.PopRadGrid2(); 
                this.RadTextBox1_TextChanged(nullnull); 
 
 
            } 
//Searchbox 
protected void RadTextBox1_TextChanged(object sender, EventArgs e) 
        { 
 
            string text = RadTextBox1.Text; 
            if (text != null
            { 
                Dt = GetDataTable("SELECT * FROM Licenses WHERE LicenseName LIKE '%" + text + "%' ORDER BY LicenseName"); 
                DatabindAll(); 
            } 
 
        } 
//Highlight the specific letters 
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
 
            string searchtext = RadTextBox1.Text.Trim(); 
 
            if (searchtext.Length > 0) 
            { 
                foreach (TableCell cell in e.Item.Cells) 
                { 
                    string cellText = cell.Text; 
                    int leftIndex = cellText.IndexOf(searchtext, StringComparison.OrdinalIgnoreCase); 
                    if (leftIndex != -1) 
                    { 
                        int rightIndex = leftIndex + searchtext.Length; 
                        StringBuilder builder = new StringBuilder(); 
                        builder.Append(cellText, 0, leftIndex); 
                        builder.Append("<span class=\"highlight\">"); 
                        builder.Append(cellText, leftIndex, rightIndex - leftIndex); 
                        builder.Append("</span>"); 
                        builder.Append(cellText, rightIndex, 
                        cellText.Length - rightIndex); 
                        cell.Text = builder.ToString(); 
                    } 
                } 
            } 
 
        } 
 
//RadGrid1 is Main Grid that shows all data. 
//RadGrid2 and 3 are column chooser. 
private void DatabindAll() 
      { 
          RadGrid RadGrid2 = (RadGrid)RadPanelBar1.FindItemByValue("RadGrid2").FindControl("RadGrid2"); 
          RadGrid2.DataSource = Dt_left; 
          RadGrid2.DataBind(); 
 
          RadGrid RadGrid3 = (RadGrid)RadPanelBar1.FindItemByValue("RadGrid2").FindControl("RadGrid3"); 
          RadGrid3.DataSource = Dt_right; 
          RadGrid3.DataBind(); 
 
 
          RadGrid1.DataSource = Dt; 
          RadGrid1.DataSourceID = string.Empty; 
          RadGrid1.DataBind(); 
      } 
 private void ConfigureExport() 
        { 
            RadGrid1.ExportSettings.FileName = "AllLicenses"
            RadGrid1.ExportSettings.ExportOnlyData = false
            RadGrid1.ExportSettings.IgnorePaging = true
        } 
 
 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) 
        { 
            ConfigureExport(); 
            RadGrid1.MasterTableView.ExportToExcel(); 
        } 
 


I think the second problem ExportToExcel is from the first problem. But even if I try to export when the website first load there is nothing in the excel file. But also this is working in all other browsers except IE8.

 So I hope we can solve this together.

For a runable demo I need to send sensitive information to your email. You can send you email to: 
christopher dot svensson at ateaspintop dot com

Regards

Christopher Svensson
System Developer
atespintop.com
0
Christopher Svensson
Top achievements
Rank 1
answered on 01 Jun 2010, 09:21 AM
0
Christopher Svensson
Top achievements
Rank 1
answered on 01 Jun 2010, 02:58 PM
Hi!

I have tried following chase:

1, Search an empty string: Result returnd rows but nothing is shown.
2, Change the amount result on a page in radgrid:Whole grid dissapears.
3.Search again an empty string: 1 more grid shown on top of the other one.
 but no records.

I can't figure it out, why radgrid not work in IE8?

Regards

Christopher Svensson
System Developer
Site: www.atespintop.com
Facebook :Ateaspintop


0
Daniel
Telerik team
answered on 04 Jun 2010, 11:25 AM
Hello Christopher,

The problem is probably caused by a databinding issue. I recommend that you try the following options:

1) Set RadGrid1.ExportSettings.IgnorePaging = false; and then let me know whether the problem still persists

2) Try advanced data-binding (NeedDataSource event) instead of simple data-binding. This is the easiest way to address such issues.

Advanced Data-binding topic
Simple Data-binding topic
Advanced Data Binding demo

If you need to share sensitive data/information please use the ticketing system to submit it.

Best regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Christopher Svensson
Top achievements
Rank 1
answered on 07 Jun 2010, 02:18 PM
Hi Daniel!

I have tried your suggestions.

Nothing of them worked for me.

There seems to be something in IE8 that can't render the grid right.

On my development PC, I use Visual Studio to run and test. I use IE8. It's work on my own PC but not when I move it to the Production Server for publish?

The production server is Win XP 2003 Server SP 2.

Best Regards

Christopher Svensson
System Developer
Site: www.atespintop.com
Facebook :Ateaspintop
0
Accepted
Daniel
Telerik team
answered on 09 Jun 2010, 01:46 PM
Hello Christopher,

I created a runnable project based on your code-snippets (it is attached to the support ticket). Please let me know how to modify it in order to reproduce the issue.
 
Kind regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Christopher Svensson
Top achievements
Rank 1
answered on 10 Jun 2010, 01:21 PM
Hi!

I have send you an live demo in the support-ticket.

Please read that thread.

Regards

Christopher
0
Christopher Svensson
Top achievements
Rank 1
answered on 23 Jun 2010, 12:52 PM
Hi everybody out there!

Now I have solve my issue.

If you use Session-variables to store a DataTable in, it can be cause that you get problem with IE8. 
This was the problem for me.
IE8 seems to have some security that not allowed me to use Session in this particular case.

Only thing I changed was to use ViewState instead of Session to store my DataTable in.

So now everything works in all the major browsers on the market.

The function ExportToExcel works great when the grid has something to show. This issue was an error that was caused by the Session issue.

Don't forget to Databind and check if your datasource is not empty.

Best Regards
Christopher Svensson
System Developer
Site: www.atespintop.com
Facebook :Ateaspintop
Tags
Grid
Asked by
Christopher Svensson
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Christopher Svensson
Top achievements
Rank 1
Share this question
or