DataFormDataField delimit stringlenght on x chars

2 posts, 1 answers
  1. Volker
    Volker avatar
    7 posts
    Member since:
    Nov 2011

    Posted 23 Mar 2012 Link to this post


    can i delimit the inputted string length to 12 chars?

    my field in the database had only 12 chars. But i can input more than 12 chars in my DataformDatafield.

    If i input more than 12 chars i get an Entity.ValidationError by the submit.

    is it not possible to say, that the user can only input 12 characters? i found no property for that...

     here is my definition:

     <telerik:DataFormDataField DataMemberBinding="{Binding mark,Mode=TwoWay}" Label="Mark:"  />

     The field mark hat only 12 chars, what i have to change, that the end user can only input 12 chars?


  2. Answer
    Ivan Ivanov
    Ivan Ivanov avatar
    1201 posts

    Posted 23 Mar 2012 Link to this post

    Hello Volker,

    You can either try finding the TextBox, which is placed in the respective DataFormDataField, in the visual tree and set its MaxLength property, or specify ContentTemplate for the field like this:
    <telerik:DataFormDataField ... >
    <TextBox ... MaxLength="5" />
    </telerik:DataFormDataField ... >
    DataFormDataField does not expose such property as it is the base type for the other editor fields types, where such property won't make any sense.

    Ivan Ivanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top