FrozenColumn leaving empty space at right end of the grid.

8 posts, 0 answers
  1. Muhammad Irfan
    Muhammad Irfan avatar
    18 posts
    Member since:
    Jan 2010

    Posted 02 Feb 2010 Link to this post

     I am facing one problem in RadGrid. After setting the FrozenColumnCount property, when I (horizontally) scrolled to the right end of the grid, it is leaving empty space (see the attach image). Here is the code which I am using.

    <form id="form1" runat="server">
        <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
       
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" Width="100%">
            <MasterTableView HeaderStyle-Width="80px"></MasterTableView>
            <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" FrozenColumnsCount="2"></Scrolling>
                <Selecting AllowRowSelect="true" />   
            </ClientSettings>
        </telerik:RadGrid>
        </div>
        </form>

    Code Behind is:

    protected void Page_Load(object sender, EventArgs e)
        {
            RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
            RadGrid1.PreRender += new EventHandler(RadGrid1_PreRender);
            RadGrid1.ItemDataBound += new GridItemEventHandler(RadGrid1_ItemDataBound);
        }

        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            //RadGrid1.MasterTableView.AutoGeneratedColumns[7].HeaderStyle.Width = Unit.Pixel(40);
            //RadGrid1.MasterTableView.AutoGeneratedColumns[10].HeaderStyle.Width = Unit.Pixel(40);
        }

        protected void RadGrid1_PreRender(object sender, EventArgs e)
        {

        }

        protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            RadGrid1.DataSource = GetResultsTable();
        }

        public DataTable GetResultsTable()
        {
            DataTable dt = new DataTable();

            for (int i = 0; i < 70; i++)
            {
                dt.Columns.Add("Column " + i);
                List<object> objectNumbers = new List<object>();

                for (int j = 0; j < 10; j++)
                {
                    objectNumbers.Add(i.ToString() + "," + j.ToString());
                }

                while (dt.Rows.Count < objectNumbers.Count)
                {
                    dt.Rows.Add();
                }

                for (int k = 0; k < 10; k++)
                {
                    dt.Rows[k][i] = objectNumbers[k];
                }
            }
            return dt;
        }



    I will really appreciate for quick response. Thanks

    Best Regards,
    M. Irfan
  2. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 02 Feb 2010 Link to this post

    This comes from the fact that the width of the MasterTableView is smaller than the width of the overall Grid. Have you tried setting the property TableLayout of the MasterTableView to "fixed"? I think this should take care of it :)
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Muhammad Irfan
    Muhammad Irfan avatar
    18 posts
    Member since:
    Jan 2010

    Posted 03 Feb 2010 Link to this post

    I have also tried after giving the same width to MasterTableView and Layout=Fixed but no change. Kindly help.
  5. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 03 Feb 2010 Link to this post

    When you set the TableLayout to fixed did you still define headerstyle-widths? Have you tried setting either the headerstyle-width to a larger amount of pixels or perhaps a percentage to see if that helps? Also you can try setting the width of the MasterTableView as well and then not define any headerstyle-widths to see if this resolves the issue.
  6. Muhammad Irfan
    Muhammad Irfan avatar
    18 posts
    Member since:
    Jan 2010

    Posted 03 Feb 2010 Link to this post

    Yes I tried in both ways.....set Width and TableLayout with headerstyle-width AND without headerstyle-width. But still problem persist.

    I have a sample application so that problem can be reproduced but here I can only attach images. :(

  7. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 03 Feb 2010 Link to this post

    The easiest way to resolve this is to remove the UseStaticHeaders property, or set it to false. Are you looking into having the functionality of this property? If so I would recommend that either you define the width of the RadGrid in pixels and define the width of the headerstyle-width of the columns to add up to this width.
  8. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 04 Feb 2010 Link to this post

    Turning off UseStaticHeaders means we give up valuable functionality in order to hide a bug. That's not a solution.

    I've also been struggling with this issue which is cross-browser and doesn't seem to be affected by the settings discussed so far. My bet is that this is a bug. I've been told by Support that there are a couple bugs related to frozen columns which have been fixed and should be available in the next release.  I'm really hoping this one is addressed as well.
  9. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 05 Feb 2010 Link to this post

    Hello all,

    The problem with the empty space appearing after the last column has been fixed. Changes will take effect in Q1 2010 Beta (due in mid February) and Q1 2010 official (due in early March).

    You can also download some of the next internal builds.

    All the best,
    Dimo
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017