Validate DropdownList

3 posts, 1 answers
  1. Karl
    Karl avatar
    172 posts
    Member since:
    Jun 2009

    Posted 16 Feb 2012 Link to this post


    What is the best way to validate a raddropdownlist?  I'v looked at the _Validating Event but this appears to only fire when you select another control.

    When I try the selectedvlue_changed this appears to fire when the control is being databound etc.

    Any help or pointers would be great.

  2. Answer
    Peter avatar
    1160 posts

    Posted 20 Feb 2012 Link to this post

    Hi Karl,

    Thank you for writing.

    By default, WinForms controls are validated on Leave and this behavior is normal.
    You can put your validation logic at the SelectedIndexChanged event, for example:

    radDropDownList1.DataSource = dataTabel1;//this will fire SelectedIndexChanged event with Selectedindex = 0
    radDropDownList1.SelectedIndexChanged+= radDropDownList1_SelectedIndexChanged;//subscribe for event after the databinging
    void radDropDownList1_SelectedIndexChanged(objectsender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)

    I hope this helps. Don't hesitate to contact us if you have other questions.

    All the best,
    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. Karl
    Karl avatar
    172 posts
    Member since:
    Jun 2009

    Posted 23 Feb 2012 Link to this post

Back to Top