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

2 posts, 0 answers
  1. Sam Phen
    Sam Phen avatar
    10 posts
    Member since:
    Feb 2010

    Posted 22 Sep 2015 Link to this post

    Hello,

    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
                   lstIndex.Add(col.OrderIndex)
               End If
           Next
           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..

     

     

     

  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 23 Sep 2015 Link to this post

    Hi,

    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.

    Regards,
    Pavlina
    Telerik
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top