Filter textbox sizing

3 posts, 0 answers
  1. geno_telerik
    geno_telerik avatar
    1 posts
    Member since:
    Nov 2006

    Posted 03 Jan 2007 Link to this post


    r.a.d.controls version

    Q3 2006

    .NET version


    Visual Studio version


    programming language    

    browser support

    all browsers supported by r.a.d.controls

    This project was started to address 2 problems with the method described in the documentation for changing the textbox sizes in the filter row.

    Problem 1:  Needed to specify each column name and create a new textbox variable for each column.

    Problem 2:  If columns exist in the master table, but not in child tables, the documented method will generate an error.

    Solution:  The following Subroutine will cycle through the columns without specifying them - thus reducing code and eliminating potential problems should the columns change or not exist in all tables.

        Protected Sub rgrPurchaseOrders_ItemCreated(ByVal sender As Object, ByVal e As Telerik.WebControls.GridItemEventArgs) Handles rgrPurchaseOrders.ItemCreated  
            If TypeOf e.Item Is Telerik.WebControls.GridFilteringItem Then  
                Dim filteringItem As Telerik.WebControls.GridFilteringItem = CType(e.Item, Telerik.WebControls.GridFilteringItem)  
                For Each myCell As Telerik.WebControls.GridTableCell In filteringItem.Controls  
                    If myCell.HasControls Then  
                        For Each myControl As Control In myCell.Controls  
                            If myControl.ToString = "System.Web.UI.WebControls.TextBox" Then  
                                Dim box As TextBox = myControl 
                                box.Width = "60" 
                            End If  
                    End If  
            End If  
        End Sub 

  2. Sebastian
    Sebastian avatar
    9934 posts

    Posted 05 Jan 2007 Link to this post

    Hello Geno,

    Thank you for the post - indeed this will set the filter box dimensions for all grid columns with equal widths. However, if you would like to modify their dimensions differently, you will need to use the approach presented in the topic from the product documentation you have mentioned. Of course, to avoid exception generation in hierarchical grid with filtering enabled in each level, you can distinguish the level in the hierarchy as demonstrated here.

    500 telerik points were added to your account for the feedback.

    Best wishes,
    the telerik team
  3. Dheepa
    Dheepa avatar
    31 posts
    Member since:
    Oct 2007

    Posted 27 Feb 2008 Link to this post

    The other way to do it is set it in css.


    input, .GridHeaderDiv_WebBlue input


    width: 60px;


Back to Top