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

Copy value as text from 1 combo box to another using js

3 Answers 83 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 13 Jun 2012, 11:53 PM
Hey all

I was wondering how you can copy a value as text from one combo box to another (as text on the destination combobox) using javascript, and concatenating additional values as a text string.

Thanks!

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 14 Jun 2012, 04:09 AM
Hi Bill,

Try the following Javascript to achieve your scenario.

JS:
<script type="text/javascript" >
        function OnClientSelectedIndexChanged(sender, args)
        {
            var stateTxt = $find("<%=RadComboBox1.ClientID%>").get_value();
            $find("<%= RadComboBox2.ClientID %>").set_text(stateTxt);
        }
     
</script>

Thanks,
Princy.
0
Bill
Top achievements
Rank 1
answered on 17 Jun 2012, 05:55 AM
Princy

Thanks for the help. I was wondering though: how do you specify the client id for a radcontrol from a javascript inside the master page to a content page? As well, I recall seeing different properties for a radcontrol that are used in javascript on your site. You have a link for that page?

Thanks again!
Bill
0
Princy
Top achievements
Rank 2
answered on 18 Jun 2012, 09:29 AM
Hi Bill,

Try the following code snippet to achieve your scenario. 

JS:
<script type="text/javascript" >
        function OnClientClick()
        {
            var txtCont = document.getElementById('<%= Page.Master.FindControl("MainContent").FindControl("RadComboBox1").ClientID %>');
        }
</script>

Hope this helps.

Thanks,
Princy.
Tags
ComboBox
Asked by
Bill
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Bill
Top achievements
Rank 1
Share this question
or