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

How to freeze Columns in Radgrid

14 Answers 2483 Views
Grid
This is a migrated thread and some comments may be shown as answers.
naveen veda
Top achievements
Rank 1
naveen veda asked on 14 May 2009, 06:56 AM
hi,

i am using Radgrid in my application. i want to freeze one column in this (like Excel column freeze).

how to do this.

i am having more number of columns in my rad grid, once i have moved ro right the employeeid column becomes invisible.

i want to show it always,what to do?

give me a suggestion.

thanks,

14 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 May 2009, 07:17 AM
Hello Naveen Veda,

To enable Frozen Columns, set the ClientSettings.Scrolling.FrozenColumnsCount property to a value greater than 0. The value of FrozenColumnsCount specifies the number of columns (starting with the leftmost column) that do not scroll when the user scrolls the grid horizontally, using the horizontal scroll bar.

ASPX:
 
<telerik:RadGrid ID="RadGrid1" Width="500px" runat="server" AllowMultiRowSelection="true" AllowPaging="True" DataSourceID="SqlDataSource1"
    <MasterTableView AutoGenerateColumns="False" DataKeyNames="CustomerID" PageSize="4" DataSourceID="SqlDataSource1"
        <Columns>                    
          . . . 
        </Columns>                 
    </MasterTableView> 
    <ClientSettings> 
        <Scrolling AllowScroll="true" FrozenColumnsCount="1" SaveScrollPosition="true" UseStaticHeaders="true" /> 
    <ClientEvents  /> 
    </ClientSettings> 
</telerik:RadGrid> 

Thanks,
Shinu.
0
naveen veda
Top achievements
Rank 1
answered on 14 May 2009, 07:34 AM
Hi Shinu,

Thanks for ur reply.

after  using this tag

<Scrolling AllowScroll="true" FrozenColumnsCount="1" SaveScrollPosition="true" UseStaticHeaders="true" /> 

it gives the error,

Type 'Telerik.WebControls.GridScrolling' does not have a public property named 'FrozenColumnsCount'.
Validation (ASP.Net): Attribute 'FrozenColumnsCount' is not a valid attribute of element 'Scrolling'.

can u send me the soluntion.

thanks.
0
Sebastian
Telerik team
answered on 14 May 2009, 08:44 AM
Hello naveen,

Can you please verify that you are using the ASP.NET AJAX version of RadGrid in your project? Review the following online demo as well:

http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/frozencolumns/defaultcs.aspx

Regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
naveen veda
Top achievements
Rank 1
answered on 14 May 2009, 09:14 AM
I am using the older version.

in that version is there any way to do the freezing?

thanks,
0
Sebastian
Telerik team
answered on 14 May 2009, 09:43 AM
Hi naveen veda,

In case you use RadGrid for ASP.NET, make sure you have v5 or later of the product:
http://www.telerik.com/help/aspnet/grid/grdwhatsnew.html

Regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jay
Top achievements
Rank 2
answered on 25 Jan 2013, 03:36 PM
I have the same issue, and I am sure we are using at least V5 of RadGrid for Asp.Net.  In my case, the grid is built in the code behind as show below.  I have added the statement for FrozenColumnsCount, but it has no effect.  Any ideas??

Private Sub GenerateGrid()

        Dim objGrid As New RadGrid
        Dim objBoundColumn As GridBoundColumn = Nothing
        Dim objTemplateColumn As GridTemplateColumn = Nothing
        Dim objReportTag As LabReportTag = Nothing
        Dim strHeaderText As String = String.Empty

        ' -- Set the Grid's properties --'
        objGrid.ID = "grdLabData"
        objGrid.Skin = "DAK"
        objGrid.EnableEmbeddedSkins = False
        objGrid.AutoGenerateColumns = False
        objGrid.ShowFooter = True
        objGrid.ShowStatusBar = True
        objGrid.FilterMenu.EnableEmbeddedSkins = True
        objGrid.FilterMenu.Skin = "Gray"
        objGrid.FilterItemStyle.Wrap = False
'This next line does not work
objGrid.ClientSettings.Scrolling.FrozenColumnsCount = "4"

        ' -- Set the MasterTableView properties -- '
        objGrid.MasterTableView.AllowSorting = True
objGrid.MasterTableView.AutoGenerateColumns = False
        objGrid.MasterTableView.AllowFilteringByColumn = False
        objGrid.MasterTableView.CommandItemTemplate = New CommandRowTemplate
        objGrid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top
        objGrid.MasterTableView.ShowGroupFooter = True
        objGrid.MasterTableView.Width = Unit.Pixel(0)

        ' -- Add The Data Key names -- '
        objGrid.MasterTableView.DataKeyNames = New String() {"LoggedDate"}

        ' -- Export Settings -- '
        objGrid.ExportSettings.IgnorePaging = True
        objGrid.ExportSettings.OpenInNewWindow = True
        objGrid.ExportSettings.ExportOnlyData = False
        objGrid.ExportSettings.Excel.Format = GridExcelExportFormat.Html
0
Eyup
Telerik team
answered on 30 Jan 2013, 09:27 AM
Hi Jay,

Can you please confirm that you are enabling grid scrolling?
grid.ClientSettings.Scrolling.AllowScroll = true;
grid.ClientSettings.Scrolling.UseStaticHeaders = true;
grid.ClientSettings.Scrolling.FrozenColumnsCount = 4;
And also static headers?
http://www.telerik.com/help/aspnet-ajax/grid-frozen-columns.html

Additionally, please verify that you are setting an Integer value to the property and not String type.

Looking forward to your reply.

Greetings,
Eyup
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
Jay
Top achievements
Rank 2
answered on 30 Jan 2013, 02:04 PM
Thank you for responding to my inquiry.  Since I posted this the other day, i found that the scroll bar in the window was actually from the PlaceHolder that contained the grid.  So there was no way that scroll bar would freeze the columns.  However, when I removed that scrollbar and added the scrolling in the grid (as below), there is white space at the bottom of the grid, and still no frozen columns. (see screenshot)

PlaceHolder
<div style="overflow: background-color: White;">
       <asp:PlaceHolder ID="placeholder1" runat="server" />
</div>

RadGrid
' -- Set the MasterTableView properties -- '
objGrid.MasterTableView.AllowSorting = True
objGrid.MasterTableView.AutoGenerateColumns = False
objGrid.MasterTableView.AllowFilteringByColumn = False
'--Scrolling --'
objGrid.ClientSettings.Scrolling.AllowScroll = True
objGrid.ClientSettings.Scrolling.UseStaticHeaders = True
objGrid.ClientSettings.Scrolling.FrozenColumnsCount = "2" (text)


0
Eyup
Telerik team
answered on 04 Feb 2013, 08:16 AM
Hi Jay,

As suggested in my previous post, please set an Integer value when defining the number of frozen columns:
objGrid.ClientSettings.Scrolling.FrozenColumnsCount = 2

Generally, the compiler should fire an exception when trying to run your code. Do you have any wrapping try-catch parts?

Regards,
Eyup
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
Jay
Top achievements
Rank 2
answered on 05 Feb 2013, 12:47 PM
That seemed to do the trick, but only in IE, not Chrome.

Thank you!!
0
Eyup
Telerik team
answered on 08 Feb 2013, 09:31 AM
Hi Jay,

Can you please verify that you are closely following the steps provided in the following topic when creating your grid dynamically?
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html#Section4

Additionally, please confirm that you are not implementing any feature which is not compatible with frozen columns:
http://www.telerik.com/help/aspnet-ajax/grid-frozen-columns.html ( Last Section )

Looking forward to your reply.

Regards,
Eyup
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
Jay
Top achievements
Rank 2
answered on 08 Feb 2013, 01:41 PM
I had not fully checked Chrome.  it works the same in Chrome as it does in IE9, which is functional, not perfect.  it works perfectly in IE8 and back.  In IE9 and Chrome, when you first open the page, it does not work.  You have to maximize or tile your browser to get it to work.  Once you have done that once, it works and you can tile or maximize your screen at will and it works.

There is a link on the page that changes the data table to show data from different machines.  If you click that link it does a Rebind() on the grid.   Once that is done, you have to maximize your screen again to get the freeze columns to work.

The code conforms to what is in both pages you mention.

Thanks,

Jay
0
Eyup
Telerik team
answered on 13 Feb 2013, 09:32 AM
Hi Jay,

I have created a sample RadGrid web site to test the described issue. On my side the grid appears as expected. Can you please provide us the exact steps to reproduce the problematic behavior using the application?

Regards,
Eyup
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
Jay
Top achievements
Rank 2
answered on 13 Feb 2013, 01:35 PM
  • Open IE9 in windowed mode
  • Navigate to the application
  • Click on the RadMenu link to the page with the grid with frozen columns.
  • Scroll to the right - the columns are not frozen
  • Maximize th window
  • Scroll to right again - the columns are frozen
  • Put the browser back in windowed mode, columns are still frozen
  • Clcik on the drop down to change the machine and rebind the grid
  • Scroll to the right - the columns are not frozen again
  • Re-maximize the window
  • Scroll to right again - the columns are frozen again

I'll try loading your application to see how it behaves...it wordked, the grid froze the column as it should have. We'll check the differenein the code.

Thanks,
Jay

Tags
Grid
Asked by
naveen veda
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
naveen veda
Top achievements
Rank 1
Sebastian
Telerik team
Jay
Top achievements
Rank 2
Eyup
Telerik team
Share this question
or