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

100% percent filter control width

4 Answers 403 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Slava Dolgov
Top achievements
Rank 1
Slava Dolgov asked on 26 Jan 2010, 04:51 AM
I use standard filters for each grid column. The functionality works fine.
But we would like to fit the filter controls automatically when user resizes the columns.

Grid contains corresponding property "FilterControlWidth" and it is possible to set it to "100%". But, unfortunately, it doesn't work as we expected. The "100%" width can be specified only for the textbox and it means that corresponding filter icon always wraps.
The similar problem is for DateTime columns with textbox and 2 icons (date selection and filter).

The idea is to set "100%" for a wrapper on the textbox and filter icon in order to avoid the filter row wrapping.

Is it possible to fit the filter controls automatically?

4 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 26 Jan 2010, 08:24 AM
Hi Slava,

I am afraid there is no wrapper for the filter textbox and icon.

Here is a demo, which shows how to make filtering controls expand together with the columns:

http://www.telerik.com/community/code-library/aspnet-ajax/grid/how-to-make-radgrid-filtering-controls-resize-together-with-the-columns.aspx

Sincerely yours,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
JonnyDub
Top achievements
Rank 1
answered on 15 Jul 2010, 12:33 AM
This doesn't solve the problem of the filter icon wrapping.  If the filter textbox and icon have a larger combined width than the data in the grid, the filter icon will still wrap.  Any other ideas?
0
Dimo
Telerik team
answered on 15 Jul 2010, 06:44 AM
Hello Jonny,

Here is a demo:

<%@ 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 = 8;
    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_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridFilteringItem)
    {
        foreach (TableCell cell in e.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>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<telerik:RadGrid
    ID="RadGrid1"
    runat="server"
    AllowFilteringByColumn="true"
    OnNeedDataSource="RadGrid_NeedDataSource"
    OnItemCreated="RadGrid1_ItemCreated">
    <%--<MasterTableView TableLayout="Fixed" />--%>
</telerik:RadGrid>
 
</form>
</body>
</html>


All the best,
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
Vamsi Kamal
Top achievements
Rank 1
answered on 17 Aug 2012, 01:24 PM
Hi Telerik Team,

I am facing a width related issue with RadGrid Filtering control.
Even though I am setting the width to 100%, the items list of drop down filter control's width is not increasing to 100%.
Could you plz help me in fixing this issue.

Please find the attachment to better understanding the problem.
Tags
Grid
Asked by
Slava Dolgov
Top achievements
Rank 1
Answers by
Dimo
Telerik team
JonnyDub
Top achievements
Rank 1
Vamsi Kamal
Top achievements
Rank 1
Share this question
or