This is a migrated thread and some comments may be shown as answers.

Get RadComboBox text using javascript

1 Answer 378 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
bharat kumar
Top achievements
Rank 1
bharat kumar asked on 27 Apr 2010, 03:05 PM
Hi,

i have two radcombobox on my page..
          <telerik:RadComboBox ID="cboSourceFund" runat="server"
                            DataSourceID="SourceFundDataSource" DataTextField="AFIMSFundCode" DataValueField="AFIMSFundCode" 
                            Width="55px" Skin="Outlook" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged1" SelectedValue='<%# Bind("SourceAfimsFund") %>'
                            BorderWidth="1px">
                       </telerik:RadComboBox>                        
                       
                        <telerik:RadComboBox ID="cboSourceFundHidden" runat="server"
                            DataTextField="AFIMSFundCode" DataValueField="BaseCurrencyCode" 
                             style="display:none;">
                       </telerik:RadComboBox> 

i have one javascript function

function GetCurrency(value) {

    var cboSourceFundHidden = document.getElementById("ctl00_messagePanelsContent_contentPlaceHolder_fvAllotmentDetail_cboSourceFundHidden");

    for (index1 = 0; index1 < cboSourceFundHidden.options.length; index1++) {
        alert("22");
        if (cboSourceFundHidden.options[index1].value == value) {
            return value;
            break;
        }

    }    
  
}

and this function is called from here

function OnClientSelectedIndexChanged1(item)
 {
var currency = GetCurrency(item._value);
}

but the above code is not working and i am not getting count in 
alert(cboSourceFundHidden.options.length);
its giving nothing while dropdown object is present
alert(cboSourceFundHidden);

please help.

thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Apr 2010, 07:11 AM

Hello Bharat,

Since you are using ASP.NET AJAX version, use the $find() method to get reference to client side object of control. I hope the following links would be helpful for you.

Client-Side Basics

RadComboBox object

The following link describes how to get the selected item text in ClientSelectedIndexChanged event.

OnClientSelectedIndexChanged

-Shinu.

Tags
ComboBox
Asked by
bharat kumar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or