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

RadGrid WindowResize issue

5 Answers 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DvdBrink
Top achievements
Rank 1
DvdBrink asked on 13 Mar 2012, 02:38 PM
Hi Telerik,

I'm having an issue with the RadGrid control.

After resizing my browserwindow my radgrid is being resized.
It changes my height with a few pixels.

I tried debugging the javascript and in the setDataDivHeight function it decides to  remove 17 pixels because Telerik.Web.UI.Grid.getScrollBarHeight() returns 17. But I didn't have a scrollbar!

Currently i'm using Telerik controls version: 2011.2.915.35.

Is there a workaround for this?

5 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 16 Mar 2012, 09:16 AM
Hi,

Can you please post your grid declaration, so that we can test it locally and see what causes the issue and how it could be addressed? In the meantime you could try running your project with the latest RadControls dlls to see if the problem is still there.

Greetings,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
DvdBrink
Top achievements
Rank 1
answered on 26 Mar 2012, 01:42 PM
I tried to use the latest version but the problem still exists.

I have created a sample where i have this issue. The code is a bit ugly that doesn't really matter.
The issue seems to be related to the prototypeJs library.

When I open this sample and resize the browser window, the error occurs.

Thank you for youre time.

Edit: I cant add .zip files so how to send you my sample?
0
Tsvetina
Telerik team
answered on 26 Mar 2012, 01:55 PM
Hi,

You could open a formal support ticket and attach your project there. Alternatively, if your code can be run without database and custom classes, you could post it in a code block in this thread.

All the best,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
DvdBrink
Top achievements
Rank 1
answered on 26 Mar 2012, 02:13 PM
I moved all my code the the Default and I don't use the designer, so a new project with an empty Default.aspx should do the trick.

using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace WebApplication1
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.UI.ScriptManager sm = new System.Web.UI.ScriptManager();
            form1.Controls.Add(sm);
            RadGrid RadGrid1 = new RadGrid();
            form1.Controls.Add(RadGrid1);
            Literal script = new Literal();
            script.Text = "<script src=\"http://www.google.com/jsapi\" type=\"text/javascript\"></script>" +
                        "<script type=\"text/javascript\">google.load(\"prototype\", \"1.6.1.0\");</script>";
            Header.Controls.Add(script);
            RadGrid1.ClientSettings.Resizing.AllowColumnResize = true;
            RadGrid1.ClientSettings.Resizing.ResizeGridOnColumnResize = false;
            RadGrid1.ClientSettings.Scrolling.AllowScroll = true;
            RadGrid1.ClientSettings.Scrolling.UseStaticHeaders = true;
            RadGrid1.ClientSettings.Selecting.AllowRowSelect = true;
            RadGrid1.MasterTableView.AllowMultiColumnSorting = true;
            RadGrid1.MasterTableView.AllowCustomSorting = true;
            RadGrid1.AllowSorting = false;
            RadGrid1.AllowMultiRowSelection = true;
            RadGrid1.AutoGenerateColumns = true;
            RadGrid1.MasterTableView.CellSpacing = 0;
  
            RadGrid1.Width = new Unit(100, UnitType.Percentage);
            RadGrid1.GridLines = GridLines.None;
            RadGrid1.HeaderStyle.Wrap = false;
            RadGrid1.MasterTableView.AlternatingItemStyle.Height = RadGrid1.MasterTableView.ItemStyle.Height;
            RadGrid1.AllowMultiRowEdit = true;
            RadGrid1.ClientSettings.Scrolling.FrozenColumnsCount = 2;
            RadGrid1.Height = 500;
 
            RadGrid1.HeaderStyle.Width = 20;
            RadGrid1.MasterTableView.Width = 10 * 2 ;
 
            List<string> list = new List<string>();
            list.Add("test1");
            list.Add("test1");
            list.Add("test1");
            list.Add("test1");
            list.Add("test1");
 
            RadGrid1.DataSource = list;
        }
 
    }
}

Thanks.

Edit: whoops, I mixed up an issue. The above sample code is having a javascript error on window resize, but not the wrong resize behaviour I described on my first post. I will try to create a new sample for the wrong resize behaviour.
I also want the javascript error fixed though.
0
Tsvetina
Telerik team
answered on 28 Mar 2012, 04:56 PM
Hi,

I could not replicate the problem with the setDataDivHeight method. With the provided code I got a different script error on window resize (Error: Object doesn't support property or method 'get_visible') and it was caused by the fact that you were incorrectly registering the scripts on your page.
To load the external script, use the ScriptManager as follows:
sm.Scripts.Add(new ScriptReference("http://www.google.com/jsapi"));

And, for the script that needs to execute, use the static RegisterClientScriptBlock method of the ScriptManager class.

Let me know if this change fixes the issue on your side, too.

All the best,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
DvdBrink
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
DvdBrink
Top achievements
Rank 1
Share this question
or