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

Add custom filtertemplate in RadGrid

3 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raji
Top achievements
Rank 1
Raji asked on 11 Nov 2011, 02:43 AM
Hi,

Does any one know how to add custom filtertemplates in RadGrid dynamically? I have a RadGrid with column filtering. The colums are built dynamically based on datatype. For numeric it uses GridNumericColumn and for date it uses GridDateTimeColumn. The numeric column filter box puts comma after you have entered the numbers. I do not want the comma to appear. I also want to limit the text length entered in the filter field.

Thanks,
Raji

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Nov 2011, 05:26 AM
Hello Raji,

Try the following code snippet to limit the number of characters when filtering.
C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
  GridFilteringItem item = (GridFilteringItem)RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0];
  TextBox txt = (TextBox)item["ColumnUniqueName"].Controls[0];
  txt.MaxLength = 2;
}

Also check the following forum thread.
Dynamic RedGrid FilterTemplate

-Shinu.
0
Raji
Top achievements
Rank 1
answered on 14 Nov 2011, 07:51 PM
Hi Shinu,

Thanks for pointing me to the right direction. Using the link I was able to create the custom filter. Now I want to put the filter menu besides the filter textbox. Just like how the normal radgrid does the filtering by selecting the menu.

Thanks,
Raji
0
Shinu
Top achievements
Rank 2
answered on 15 Nov 2011, 06:20 AM
Hello Raji,

Check the following demo which implements the same.
Grid / Filter Templates

-Shinu.
Tags
Grid
Asked by
Raji
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Raji
Top achievements
Rank 1
Share this question
or