Validate RadFilter Field Editor

3 posts, 1 answers
  1. Laura
    Laura avatar
    7 posts
    Member since:
    May 2011

    Posted 16 Feb 2012 Link to this post

    I am building a radfilter control from code and added field editors like this:

    RadFilterTextFieldEditor textFieldEditor13 = new RadFilterTextFieldEditor();
    RadFilter1.FieldEditors.Add(textFieldEditor13);
    textFieldEditor13.DisplayName = "Display";
    textFieldEditor13.FieldName = "Table.Fieldname";

    I need to validate the RadFilterTextFieldEditor above (and any other fields I choose) by having the user enter only integer values.  How does one accomplish this?
  2. Answer
    Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 21 Feb 2012 Link to this post

    Hi Christopher,

    You could implement the desired functionality by using RadFilterNumericFieldEditor instead of RadFilterTextFieldEditor as it is shown in the example below.
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RadFilterNumericFieldEditor textFieldNumericEditpr = new RadFilterNumericFieldEditor();
            RadFilter1.FieldEditors.Add(textFieldNumericEditpr);
            textFieldNumericEditpr.FieldName = "FieldName";
            textFieldNumericEditpr.DataType = typeof(int);
        }
    }

    Greetings,
    Antonio Stoilkov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Laura
    Laura avatar
    7 posts
    Member since:
    May 2011

    Posted 21 Feb 2012 Link to this post

    Thanks, that what I ended up doing.
Back to Top