Home > DeveloperSection > Forums > Set textBox.Text=radCombo.Text in javascript
Ankit Singh

Total Post:341

Posted on    December-26-2014 5:10 AM

 ASP.Net C#  JQuery  JavaScript 

 1 Reply(s)
 854  View(s)
Rate this:

I am having a <telerik:RadComboBox> and a <asp:TextBox> in my form. i want to display textBox.Text=radCombo.Text in client side on Textchange event of the comboBox. i am using the code for this as:


    <form id="form1" runat="server">


        <asp:ScriptManager ID="ScriptManager1" runat="server">


        <telerik:RadComboBox ID="cboSample" EnableLoadOnDemand="true" runat="server" Skin="WebBlue" Text ="sample" OnClientKeyPressing  ="func()">


        <asp:TextBox runat="server" ID="txtSample"></asp:TextBox>



    <script type="text/javascript">

        function func() {

            var cbo = document.getElementById("cboSample");

            document.getElementById("txtSample").Text = cbo.getAttribute("Text");                              




what i am doing wrong? how can i achieve the goal

Ankita Pandey
Ankita Pandey

Total Post:183

Posted on    December-26-2014 7:16 AM

try below solution
 <telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientDropDownClosing="OnClientDropDownClosing1">
            <telerik:RadComboBoxItem Text="Invoice" runat="server" Selected="true" />
            <telerik:RadComboBoxItem Text="Quote" runat="server" />
    <asp:Label ID="Label1" runat="server" Text="Invoice">

    <script type="text/javascript">  
     function OnClientDropDownClosing1(sender, args) {
            var label = document.getElementById("Label1");
            label.textContent = sender._selectedItem._text;

Don't want to miss updates? Please click the below button!

Follow MindStick