I have a RadComboBox and I am attempting to retrieve the selected item in JavaScript. Using .NET 4.0. in FireFox 11.0.
The RadComboBox is as follows:
<telerik:RadComboBox ID="ddlBillingState" runat="server" AppendDataBoundItems="True" DataTextField="Name" DataValueField="StateProvinceID" ondatabinding="ddlBillingState_DataBinding" ondatabound="ddlBillingState_DataBound"> <Items> <telerik:RadComboBoxItem Text="Select a State" /> </Items> </telerik:RadComboBox>
The above RadComboBox resides inside a FormView ID=VendorFormView.
When I use the following code the JavaScript terminates before the second alert is issued. The statement with the get_selectedItem call seems to be failing. The following JavaScript is contained with the Header section of the page in which the RadComboBox resides. This JavaScript runs when the user clicks a CheckBox on the page. The ddlBillingState control does have a selected item, which was selected by the user, but when I attempt to retrieve the selected item the JavaScript terminates.
Any help would be greatly appreciated.
var ddlBillingState = document.getElementById('<%=VendorFormView.FindControl("ddlBillingState").ClientID%>'); var ddlShippingState = document.getElementById('<%=VendorFormView.FindControl("ddlShippingState").ClientID%>'); if (ddlBillingState != null && ddlShippingState != null) { alert("Assigning selected billing state"); var selectedBillingItem = ddlBillingState.get_selectedItem(); alert("selectedBillingItem assigned"); var shippingItem = ddlShippingState.findItemByText(selectedBillingItem.get_text()); alert("Shipping Item assigned"); shippingItem.select(); alert("Done"); }
how to clear RadAsyncUpload files which is hosted in Jquery UI dialog on clientside?
// clears the radasync upload
function ClearFileInput() {
var upload = $find("<%= rauMailingDocument.ClientID %>");
if (upload._uploadedFiles.length > 0) {
Array.removeAt(upload._uploadedFiles, 0);
upload.deleteFileInputAt(0);
upload.updateClientState();
}
}
Edit: Update, the above seems to work, is that the preferred method?
<telerik:RadComboBox ID="ddlSearchRoles" runat="server" EnableEmbeddedSkins="true" AllowCustomText="false" EnableLoadOnDemand="false" MarkFirstMatch="false" /><div class="rcbSlide" style="z-index: 6000; visibility: visible; display: none; overflow: hidden; margin-left: 0pt; position: absolute; top: 323.5px; left: 806.283px; height: 107px; width: 160px;"> <div id="ctl00_ContentPlaceHolder1_ddlSearchRoles_DropDown" class="RadComboBoxDropDown RadComboBoxDropDown_Default " style="display: block; visibility: visible; top: -107px; left: 0px; width: 158px;"> <div class="rcbScroll rcbWidth" style="width: 100%; overflow: auto; height: 105px;"> <ul class="rcbList" style="list-style:none;margin:0;padding:0;zoom:1;"> <li class="rcbHovered ">-All-</li> <li class="rcbItem ">Application Admin</li> <li class="rcbItem ">Dependent Member</li> <li class="rcbItem ">Practice Admin</li> <li class="rcbItem ">Primary Member</li> </ul> </div> </div></div><div id="ctl00_ContentPlaceHolder1_ddlSearchRoles" class="RadComboBox RadComboBox_Default" style="width:160px;"> <table class="" style="border-width: 0pt; border-collapse: collapse;" summary="combobox"> <tbody> <tr class="rcbReadOnly"> <td class="rcbInputCell rcbInputCellLeft" style="width:100%;"> <input id="ctl00_ContentPlaceHolder1_ddlSearchRoles_Input" class="rcbInput" type="text" readonly="readonly" value="-All-" name="ctl00$ContentPlaceHolder1$ddlSearchRoles" autocomplete="off"> </td> <td class="rcbArrowCell rcbArrowCellRight"> <a id="ctl00_ContentPlaceHolder1_ddlSearchRoles_Arrow" style="overflow: hidden;display: block;position: relative;outline: none;">select</a> </td> </tr> </tbody> </table> <input id="ctl00_ContentPlaceHolder1_ddlSearchRoles_ClientState" type="hidden" name="ctl00_ContentPlaceHolder1_ddlSearchRoles_ClientState" autocomplete="off"></div>