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

RadGrid Filter Validate Input

1 Answer 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Francesco Vivaldi
Top achievements
Rank 1
Francesco Vivaldi asked on 02 May 2011, 06:52 PM
Hi,
i need to allow user to filter column only if the input for filter is greater then 3 character, can i do this ?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 May 2011, 06:34 AM
Hello Francesco,

Try the following approach.
C#:
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.FilterCommandName)
        {
            Pair filterPair = (Pair)e.CommandArgument;
            TextBox filterBox = (e.Item as GridFilteringItem)[filterPair.Second.ToString()].Controls[0] as TextBox;
            if (filterBox.Text.Length < 3)
            {
                e.Canceled = true;
                Response.Write("Can't filter");
            }
        }
    }

Thanks,
Shinu.
Tags
Grid
Asked by
Francesco Vivaldi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or