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

Maxlength while filtering

1 Answer 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sigma
Top achievements
Rank 1
Sigma asked on 21 Aug 2012, 05:25 AM
Hi.

I have a RadGrid and in which I have enabled filtering option. How can i make users enter only 2 characters while filtering. I tried by setting MaxLength. But it is not working..

AnyBody please help me..
Sigma.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 21 Aug 2012, 05:41 AM
Hi,

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

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