RadGrid - filter textboxs, any way to control their width dynamically?

AndySousa picture AndySousa · Sep 8, 2011 · Viewed 8.2k times · Source

I have a RadGrid with a filtercontrol on it. The grid fits the size of the window, but certain views have quite a few columns and when the columns get shrunk down, the filter controls don't resize to fit. Is there any way to set those filter controls to auto fix within the width of the column?

filter

Answer

Sunil picture Sunil · Dec 27, 2015

In latest RadGrid, there is an easy fix for this. Just set the filter control width in your markup or code-behind as shown below.

Set Filter Control width in markup

<telerik:GridBoundColumn DataField="ProductName" FilterControlWidth="80%"
 HeaderText="Product Name" UniqueName="ProductName" HeaderStyle-Width="130px"
 AllowFiltering="true"></telerik:GridBoundColumn>

Set Filter Control Width in code-behind

boundColumn.FilterControlWidth = Unit.Percentage(80);