RadGrid sizing in some browsers

2 posts, 0 answers
  1. Paul Russo
    Paul Russo avatar
    2 posts
    Member since:
    Jun 2010

    Posted 15 Feb 2011 Link to this post

    When rendering a radgrid using scrolling  the grid is properly rendered with the scrolling bar, but padding is added to the right of the grid, as if scrolling was not implemented.

    For instance, say my RadGrid without scrolling is 1000px.  If I size it to 600px and add scrolling.  The Rad grid is rendered as 600px wide, with the scrolling bar.  However to the right of the RadGrid it is still padded with the remaining 400px.  I can't figure out why this padding is added.  It's as if the scroll was implemented for display, but the RadGrid still occupies it's original width space.

    Here is a sample of the code:

    <telerik:RadGrid ID="RadGridPerformance" runat="server" AutoGenerateColumns="False" Width="600px" Height="175px" >
     <MasterTableView TableLayout="Fixed">
                     <telerik:GridBoundColumn HeaderText="" DataField="Year"  />
                            <telerik:GridBoundColumn HeaderText="YTD" DataField="Ytd"  />
                            <telerik:GridBoundColumn HeaderText="Jan" DataField="Jan"  />
                            <telerik:GridBoundColumn HeaderText="Feb" DataField="Feb"   />
                            <telerik:GridBoundColumn HeaderText="Mar" DataField="Mar"   />
                            <telerik:GridBoundColumn HeaderText="Apr" DataField="Apr"   />
                            <telerik:GridBoundColumn HeaderText="May" DataField="May"   />
                            <telerik:GridBoundColumn HeaderText="Jun" DataField="Jun"   />
                            <telerik:GridBoundColumn HeaderText="Jul" DataField="Jul"   />
                            <telerik:GridBoundColumn HeaderText="Aug" DataField="Aug"   />
                            <telerik:GridBoundColumn HeaderText="Sep" DataField="Sep"   />
                            <telerik:GridBoundColumn HeaderText="Oct" DataField="Oct"  />
                            <telerik:GridBoundColumn HeaderText="Nov" DataField="Nov"  />
                            <telerik:GridBoundColumn HeaderText="Dec" DataField="Dec"  />
            <HeaderStyle Width="60px" />
             <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" FrozenColumnsCount="1">
  2. Pavlina
    Pavlina avatar
    6167 posts

    Posted 18 Feb 2011 Link to this post

    Hello Paul Russo,

    Note that when scrolling is enabled and UseStaticHeaders is True, the grid columns should declare HeaderStyle.Width. Therefore, to resolve the problem you should set column widths using HeaderStyle-Width property. You can examine the project attached to this message which demonstrates how to achieve your goal.

    the Telerik team
Back to Top