I need to determine the value selected in a combo in the OnClientDropDownClosing event. Ive setup the combo like this
and have this javascript function
| <telerik:RadComboBox ID="RadComboBoxCategories" Runat="server" |
| EnableLoadOnDemand="true" OnClientItemsRequested="ItemsLoaded" |
| OnClientItemsRequesting="OnClientItemsRequesting" |
| onitemsrequested="RadComboBoxCategories_ItemsRequested" Skin="Web20" |
| Width="250px" AutoPostBack="False" OnClientDropDownClosing="OnCategoriesClientDropDownClosing"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </telerik:RadComboBox> |
| function OnCategoriesClientDropDownClosing(sender, eventArgs) { |
| var txt = sender.get_text(); |
| if (txt != "") |
| { |
| var masterTableView = $find("<%= RadGridSecondaryCategories.ClientID %>").get_masterTableView(); |
| var category = ""; |
| for (var i = 0, j = masterTableView.get_dataItems().length; i < j; i++) { |
| var thecell = masterTableView.getCellByColumnUniqueName(masterTableView.get_dataItems()[0], "Category"); |
| category = masterTableView.getCellByColumnUniqueName(masterTableView.get_dataItems()[0], "Category").innerText; |
| category = trim(category); |
| if (txt == category) |
| { |
| eventArgs.set_cancel(true); |
| } |
| else |
| { |
| eventArgs.set_cancel(false); |
| } |
| } |
| } |
| } |
The problem is that sender.get_text() returns the original value in the dropdown, not the newly selected value. I need this to perform a check in a grid that determines if the newly selectd value exists in the grid and if it does the operation is cancelled.
How can I get the newly selected value in the dropdown ?