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

Column Resizing issue.

6 Answers 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sweta
Top achievements
Rank 1
sweta asked on 28 Jun 2010, 11:00 AM

Hi,

When i'm trying to resize any column in my radgrid my pager control is not displayed because the grid height is increased while resizing a column. i have checked below link with options 1. allow column resize and 2. No wrap for cell content.

http://demos.telerik.com/aspnet-ajax/grid/examples/client/resizing/defaultcs.aspx

when i'm resizing a column my filter row  hieght also get increased and due to that pager control is not displayed.
i tried to give fixed height to filter row but it is not working out.

Please suggest some solution so that when i rezise any column in my grid it should not affect the size of the grid.
and my pagercontrol should display properly

thanks
sweta

6 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 29 Jun 2010, 11:48 AM
Hello Sweta,

Here is a simple demo, which shows how to achieve the desired behavior. Due to limitations in the text wrapping support in IE7, some runtime customizations are required (wrapping the cell content in <NOBR> tags).


<%@ 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 = 30;
        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;
    }
     
    protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
    {
        if (e.Column is GridBoundColumn)
        {
            (e.Column as GridBoundColumn).DataFormatString = "<nobr>{0}</nobr>";
        }
    }
 
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridFilteringItem)
        {
            GridFilteringItem item = e.Item as GridFilteringItem;
            foreach (TableCell cell in item.Cells)
            {
                if (cell.Controls.Count > 0)
                {
                    cell.Controls.AddAt(0, new LiteralControl("<nobr>"));
                    cell.Controls.Add(new LiteralControl("</nobr>"));
                }
            }
        }
    }
     
</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">
 
.rgFilterRow,
.rgFilterRow *
{
    white-space:nowrap;
}
 
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<telerik:RadGrid
    ID="RadGrid1"
    runat="server"
    Width="1000px"
    Skin="Office2007"
    AllowFilteringByColumn="true"
    AllowPaging="true"
    OnNeedDataSource="RadGrid_NeedDataSource" OnColumnCreated="RadGrid1_ColumnCreated" OnItemCreated="RadGrid1_ItemCreated">
    <ClientSettings>
        <Resizing AllowColumnResize="true" ClipCellContentOnResize="true" />
    </ClientSettings>
</telerik:RadGrid>
 
</form>
</body>
</html>


Kind 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
sweta
Top achievements
Rank 1
answered on 30 Jun 2010, 06:31 AM

Thanks Dimo

i have implemented the solution and my grid working fine.

thanks you once again...

Sweta
0
sweta
Top achievements
Rank 1
answered on 30 Jun 2010, 11:02 AM

Hello Dimo,

Solution you have provided is not working properly with my Custom Filter column.
i have dropdown list as filter control in my custom filter column. when the page get loaded custom filter dropdown is not displayed. but if hover my mouse on filter row or header column then it is displayed.
i have changed a code little bit as below. 

i have written condtion If c <> 3 Then

i have first column is checkbox and 2nd column is my custom filter column.

 

 

 

Protected Sub dglist_ItemCreated(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles dgInvoiceSelected.ItemCreated  
 
  If e.Item.ItemType = GridItemType.FilteringItem Then 
 
      Dim item As GridFilteringItem  
 
      item = e.Item  
 
      Dim c As Integer 
 
      c = 0  
 
      For Each cell As TableCell In item.Cells  
 
          If c <> 3 Then 
 
              If cell.Controls.Count > 0 Then 
 
                  cell.Controls.AddAt(0, New LiteralControl("<nobr>"))  
 
                  cell.Controls.Add(New LiteralControl("</nobr>"))  
 
               End If 
 
            End If 
 
           c = c + 1  
 
      Next 
 
   End If 
 
   If e.Item.ItemType = GridItemType.Header Then 
 
   Dim item As GridHeaderItem  
 
   item = e.Item  
 
    For Each cell As TableCell In item.Cells  
 
         If cell.Controls.Count > 0 Then 
 
               cell.Controls.AddAt(0, New LiteralControl("<nobr>"))  
 
                cell.Controls.Add(New LiteralControl("</nobr>"))  
 
         End If 
 
       Next 
 
    End If 
 
End Sub 
 

 




Please suggest some solution for it.

thanks
sweta

0
Dimo
Telerik team
answered on 01 Jul 2010, 08:51 AM
Hello Sweta,

This looks like a IE rendering problem caused by hasLayout:

http://www.satzansatz.de/cssd/onhavinglayout.html

Such issues occur randomly and depend on the page HTML and CSS code. The usual resolution is to apply a zoom:1 CSS style to a specific element(s) (e.g. some divs or tables wrapping the problematic region), so that hasLayout is triggered and the control rendering is proper.

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
sweta
Top achievements
Rank 1
answered on 06 Jul 2010, 10:23 AM

Hello Dimo,

i have solved custom Filter issue. there was problem with radpane width. i have set radpan width and it is working fine now.
as we have implemented the solution for column resizing provided by you some other issues are raised.
1. when we expand columns scrollbars(vertical and horizontal both) are displayed. we do not want display any scroll bar on our grid if we resize any column.
2. when we descrease the width of the column white space is displayed. Please check attached image.

Please suggest some solution.

Thanks
Sweta
0
Dimo
Telerik team
answered on 06 Jul 2010, 10:45 AM
Hi Sweta,

When you use RadGrid with static headers and decrease the column widths so much that their sum is less than the RadGrid width, white space appears after the last column - this is expected. In addition, if you resize the columns, so that their cumulative width is larger than the RadGrid width, scrollbars appear.

If you think there is something else wrong, please send a runnable demo, so that we can inspect it locally.

Kind 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
Tags
Grid
Asked by
sweta
Top achievements
Rank 1
Answers by
Dimo
Telerik team
sweta
Top achievements
Rank 1
Share this question
or