This is a migrated thread and some comments may be shown as answers.
Validate DropdownList
2 Answers 48 Views
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 16 Feb 2012, 11:43 AM
Hi,

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.

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 20 Feb 2012, 02:59 PM
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)
{  
validate...
}

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

All the best,
Peter
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Karl
Top achievements
Rank 1
answered on 23 Feb 2012, 05:55 PM
Thanks
Asked by
Karl
Top achievements
Rank 1
Answers by
Peter
Telerik team
Karl
Top achievements
Rank 1
Share this question
or