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

Resizing Last Column

5 Answers 167 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Valery
Top achievements
Rank 2
Valery asked on 11 Jun 2010, 01:59 PM
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.

5 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 14 Jun 2010, 05:13 PM
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.
0
Deni
Top achievements
Rank 1
answered on 20 Oct 2010, 07:31 AM
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.
0
Dimo
Telerik team
answered on 20 Oct 2010, 02:22 PM
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
0
Acaz
Top achievements
Rank 1
answered on 20 Jan 2011, 06:29 PM
that's a bug?
0
Maria Ilieva
Telerik team
answered on 25 Jan 2011, 12:59 PM
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.
Tags
Grid
Asked by
Valery
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Deni
Top achievements
Rank 1
Acaz
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or