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

Radgrid : on setting column width from code behind, frozen column stops working

1 Answer 108 Views
This is a migrated thread and some comments may be shown as answers.
Sam Phen
Top achievements
Rank 1
Sam Phen asked on 22 Sep 2015, 10:29 AM


Scenario: In radgrid,

1. Frozen columns is set to 3

2. <Scrolling AllowScroll="true" SaveScrollPosition="true"  />

3. ColumnResizing : <Resizing ClipCellContentOnResize="false" AllowColumnResize="True" EnableRealTimeResize="false" ResizeGridOnColumnResize="false" AllowResizeToFit="true"></Resizing>

In the below mentioned server side event, when I set the HeaderStyle.Width of a clolumn, the Frozen column stops working in all browsers 

Protected Sub dgEscrow_PreRender(sender As Object, e As EventArgs)
       Dim visibleCols As Int32 = 0
       Dim lstIndex As New List(Of Integer)
       For Each col As GridColumn In dgEscrow.MasterTableView.Columns
           If col.Visible Then
               visibleCols = visibleCols + 1
           End If
       Dim lastVisibleCol As GridColumn = dgEscrow.MasterTableView.GetColumn(dgEscrow.MasterTableView.Columns(lstIndex(visibleCols - 1) - 2).UniqueName)
       lastVisibleCol.HeaderStyle.Width = Unit.Pixel(137)
       ''dgEscrow.MasterTableView.Columns(lstIndex(visibleCols - 1) - 2).HeaderStyle.Width = Unit.Pixel(137)
       'dgEscrow.MasterTableView.Columns(lstIndex(visibleCols - 1) - 2).ItemStyle.Width = Unit.Pixel(137)
   End Sub

Can you please suggest by which I can solve this problem

Please reply at the earliest because I need to provide the fix..




1 Answer, 1 is accepted

Sort by
Telerik team
answered on 23 Sep 2015, 08:31 PM

What happen if you rebind the grid by calling its Rebind() method? Basically this should help to reflect the changes. If the columns are autogenerated you could try setting fixed widths to the columns in ColumnCreated.

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 Feedback Portal and vote to affect the priority of the items
Asked by
Sam Phen
Top achievements
Rank 1
Answers by
Telerik team
Share this question