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

How to resize the filter textbox

2 Answers 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 28 Sep 2010, 10:48 PM
Hi all,

I'm using the filter for my Grid. Everything's good.
But I'm not happy with the Filter Textbox which makes my Grid wider.
Do you know how to make it smaller?

Thanks!

Andy.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Sep 2010, 05:18 AM
Hello Andy,

You can access the filter TextBox from code behind and can change its width from there.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
      if (e.Item is GridFilteringItem)
       {
           GridFilteringItem filterItem = (GridFilteringItem)e.Item;
           TextBox txt = (TextBox)filterItem["ColumnUniqueName"].Controls[0]; // accessing filter textbox
           txt.Width = System.Web.UI.WebControls.Unit.Pixel(20);
       }
   }

Thanks,
Princy.
0
Andy
Top achievements
Rank 1
answered on 29 Sep 2010, 08:59 PM
Thanks Princy!

I also find the way to edit from the aspx by using "FilterCOntrolWidth" and now you gave me another way in code. So cool!

Glad to receive a help from you!

Andy.
Tags
Grid
Asked by
Andy
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Andy
Top achievements
Rank 1
Share this question
or