Resizing Last Column

6 posts, 0 answers
  1. Valery
    Valery avatar
    45 posts
    Member since:
    Nov 2008

    Posted 11 Jun 2010 Link to this post

    Hi there,

    I've noticed something in a solution of mine and confirmed it in the RadGrid demo available at http://demos.telerik.com/aspnet-ajax/grid/examples/client/resizing/defaultcs.aspx . You can only make the last column narrower but you can't make it wider. Is there a workaround for this?

    Thanks in advance,
    V.
  2. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 14 Jun 2010 Link to this post

    Hello Valery,

    The last column normally cannot be resized to a larger width, because column resizing uses the mouse move browser event over RadGrid. The following workaround is possible though. The amount of right padding depends on how fast you want to be able to resize the last column - the faster speed, the greater the need of a right padding.

    Copy Code
    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <script runat="server">
     
        protected void RadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            DataTable dt = new DataTable();
            DataRow dr;
            int colsNum = 4;
            int rowsNum = 4;
            string colName = "Column";
     
            for (int j = 1; j <= colsNum; j++)
            {
                dt.Columns.Add(String.Format("{0}{1}", colName, j));
            }
     
            for (int i = 1; i <= rowsNum; i++)
            {
                dr = dt.NewRow();
     
                for (int k = 1; k <= colsNum; k++)
                {
                    dr[String.Format("{0}{1}", colName, k)] = String.Format("{0}{1} Row{2}", colName, k, i);
                }
                dt.Rows.Add(dr);
            }
     
            (sender as RadGrid).DataSource = dt;
        }
         
    </script>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     
    <head runat="server">
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title>RadControls</title>
    <style type="text/css">
     
    </style>
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
     
    <telerik:RadGrid
        ID="RadGrid1"
        runat="server"
        Width="800px"
        Skin="Office2007"
        style="border:0;padding-right:30px"
        OnNeedDataSource="RadGrid_NeedDataSource">
        <ClientSettings>
            <Resizing AllowColumnResize="true" ResizeGridOnColumnResize="true" EnableRealTimeResize="true" />
        </ClientSettings>
    </telerik:RadGrid>
     
    </form>
    </body>
    </html>


    Regards,
    Dimo
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Deni
    Deni avatar
    12 posts
    Member since:
    Aug 2010

    Posted 20 Oct 2010 Link to this post

    but this workaround is not working when the grid has horizontal scroll, however if the grid has vertical scroll the resizing is possible over the pixels on the vertical scroll.
  5. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 20 Oct 2010 Link to this post

    Hi Deni,

    That is correct. In your case you can add a narrow dummy column after the last one, so that the last column is actually not the last one. This workaround is probably better than the previous one.

    Sincerely yours,
    Dimo
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  6. Acaz
    Acaz avatar
    9 posts
    Member since:
    Jan 2011

    Posted 20 Jan 2011 Link to this post

    that's a bug?
  7. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 25 Jan 2011 Link to this post

    Hello Acaz,

    This is not a bug but the expected default behaviour for RadGrid. The last column normally cannot be resized to a larger width, because column resizing uses the mouse move browser event over RadGrid.


    Best wishes,
    Maria Ilieva
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017