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

RadGrid UseStaticHeaders="true" FrozenColumnsCount="1" Issue

7 Answers 276 Views
Grid
This is a migrated thread and some comments may be shown as answers.
OZAN
Top achievements
Rank 2
OZAN asked on 23 Jun 2013, 04:29 PM
Dear All,

I've been struggling to make RadGrid work with UseStaticHeaders and FrozenColumnsCount properties set. It was working yesterday before we introduced any client-side functionality and today we realized that it wasn't working correctly.

With hours of research in Google, we were not able to find any remedy for the behaviour.

Issue
Column headers won't scroll horizontally in RadGrid although following parameters are set :
AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="true" FrozenColumnsCount="1"

Remedy
During our development, we have assigned grid's ClientIDMode="Static". Having a static ClientID was the cause of this wierd problem. Once removed, horizontal scrolling was back to normal (as well as frozen columns).

Maybe it will help someone with similar issue.

Kind Regards,

OZAN GUNCELER

7 Answers, 1 is accepted

Sort by
0
Galin
Telerik team
answered on 26 Jun 2013, 05:11 PM
Hello Ozan,

I am afraid we are not able to identify what is causing the problems you are facing based on this information. I would appreciate it, if you could isolate the problem in a simple running project so that I can debug it locally.

Regards,
Galin
Telerik
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 the blog feed now.
0
OZAN
Top achievements
Rank 2
answered on 29 Jun 2013, 09:43 PM
Hello Galin,

Sorry for my delayed response...

I have prepared a sample project for you so that you can debug internally.

Attached project contains a webform with a radscriptmanager along with radgrid. OnNeedDataSource event, i generate a datatable and set datasource of the grid.

You will also notice that ClientSettings-Scrolling-AllowScroll="true" 
        ClientSettings-Scrolling-FrozenColumnsCount="1"
        ClientSettings-Scrolling-UseStaticHeaders="true" properties are set.

If you set ClientIDMode of the grid to "Static", static headers and frozen columns stop working. You will also notice that layout of the grid is destroyed.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server"></head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
<div>
<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" 
Width="600px" Height="300px"
ClientSettings-Scrolling-AllowScroll="true"
ClientSettings-Scrolling-FrozenColumnsCount="1"
ClientSettings-Scrolling-UseStaticHeaders="true">
</
telerik:RadGrid>

<
script runat="server">
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
            {
System.Data.DataTable insDt = new System.Data.DataTable();
for (int i = 0; i < 50; i++)
{
insDt.Columns.Add("Value " + Convert.ToString(i));
}

for (int i = 0; i <
30; i++)
{
System.Data.DataRow insDr = insDt.NewRow();
for (int z = 0; z < 50; z++)
{
insDr[z] = "Random Value " + Convert.ToString(z);
}
insDt.Rows.Add(insDr);
}
insDt.AcceptChanges();
RadGrid1.DataSource = insDt;
}
</script>
</div>
</form>
</body>
</html>

Preview when ClientIDMode property is not set explicitly. (ok.jpg)
Preview when ClientIDMode property set to "static" (nok.jpg)

I hope this helps,

Kind Regards,

OZAN GUNCELER
0
Galin
Telerik team
answered on 02 Jul 2013, 07:50 AM
Hello Ozan,

The issue is replicated on our side and it is an already known problem. However, Microsoft recommends using ClientIDMode=Static only for static control. RadGrid on the other hand is control with complex hierarchies of child controls and templates so setting their ClientID mode to static will break their functionality.

Regards,
Thomas
Telerik
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 the blog feed now.
0
Wiktor
Top achievements
Rank 1
answered on 12 Jun 2014, 10:09 AM
Hi Galin,

I've just bumped into the same problem - setting ClientIDMode="Static" completely breaks any client side scripting (you can't invoke get_masterTableView() for instance).

What I think personally is that it is a bug, my RadGrid is a static control - it is the only control on the page. I will not hide it, will not show it as a subcontrol and what I want is to write a separate JavaScript file, where I will know exactly what ID to use. Setting this property to Static allows me to do that, any other setting does not. Setting Static on a single grid should not break its functionality (just the ID of parent control is changed). If it is - it is a bug in Telerik library.

I can understand that this property is somewhat dangerous if people do not understand it, but I really do and I want to use it. It is year 2014 and Telerik still does not support it??? Common guys, you can do better than that!

Regards,
Wiktor




0
Vasil
Telerik team
answered on 12 Jun 2014, 01:50 PM
Hello Wiktor,

The RadGrid is composite control and also bound control. If the page has ClientIDMode all controls in each row will have the same IDs and all columns will have the same ID which will be invalid HTML.
You may have only one grid in the page, but you have many controls as part of this grid.

Making our composite controls to support this mode will take huge effort without any benefit from it. We could use this time to improve further our controls and to make some more desired features.
I don't see any reason to set ClientIDMode to Static for the grid, but if this is important to you vote for it in our feedback portal. We review constantly the feedback, and if it gets enough requests we will rise its priority in our future planing.

Regards,
Vasil
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Wiktor
Top achievements
Rank 1
answered on 13 Jun 2014, 08:46 AM
Hi Vasil,

thank you for the reply. First of all, let me explain why somebody would want to set ClientIDMode=Static on RadGrid. The scenario is the following: you have a MasterPage and a number of content pages. All content pages present more or less the same grid, so it is logical to create a user control with this grid in it and put this control on every page (just this one control). Your grid will have some client side coding, so you would want to put all you JavaScript in js resource for that. If ClientIDMode is AutoID, all RadGrids will receive ClientID basing on all naming containers from rad grid up to the master page'c content placeholder - and it will be inconvenient for JavaScript (and yes, I know how to work it around).

Now, I understand the implications of ClientIDMode on the whole page, but we are not talking about this case here. I just want to have a single RadGrid, which has an id on client side, that I can rely on. I do not mind the ids of subcontrols of this RadGrid. What you could do, and this (probably) would not be that hard to do is to set ClientIDMode on all immediate RadGrid controls to AutoID or Predictable. This will allow us to choose easily this single RadGrid from JavaScript and on the other hand all other features of WebForms will work too.

This is just an idea. I will be using Kendo UI Grid instead for this particular task, even though it does not have a number of nice features comparing to RadGrid.

Regards,
Wiktor
0
Vasil
Telerik team
answered on 18 Jun 2014, 07:43 AM
Hello Wiktor,

Thank you for the feedback and for sharing your scenario, it will be in help if we decide in future to support this case.

Regards,
Vasil
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
OZAN
Top achievements
Rank 2
Answers by
Galin
Telerik team
OZAN
Top achievements
Rank 2
Wiktor
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or