File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
controls/dropdownlist/client-side-programming Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,32 @@ function onClientDropDownClosing(sender, eventArgs) {
51
51
52
52
````
53
53
54
+ ## Validating a selection
55
+
56
+ You can validate the selection of a DropDownList by using the ` get_selectedItem() ` method:
57
+
58
+ ```` JavaScript
59
+
60
+ function ValidateDropDownList (sender , args ) {
61
+ var isSelected = false ;
62
+ var dropDown = $find (" <%= RadDropDownList1.ClientID %>" );
63
+
64
+ var selectedItem = dropDown .get_selectedItem ();
65
+
66
+ if (selectedItem) {
67
+ var selectedText = selectedItem .get_text ();
68
+ alert (" The selected item's text is " + selectedText);
69
+ isSelected = true ;
70
+ }
71
+ else {
72
+ alert (" Select an item!" );
73
+ }
74
+
75
+ return isSelected;
76
+ }
77
+
78
+ ````
79
+
54
80
55
81
56
82
## Calling a client-side method
You can’t perform that action at this time.
0 commit comments