help in javascript

2 posts, 0 answers
  1. sadiqabbas
    sadiqabbas avatar
    21 posts
    Member since:
    Mar 2009

    Posted 15 Apr 2009 Link to this post

    actually i am a newbie and need some help

    in radcombobox i am trying to do below things but not success

    <script type="text/javascript">
    function calc(sender,args)
    var footer = sender._getFooterElement();
    footer.innerHTML = args.get_item().get_text();
    <radcombobox id=rcb1 .......... onclientselectedindexchanged=calc>

    actually i want to display selected value of combo box in a label without loading whole page
    i mean text1,text2,text3 are stored in combo box then when user changes combo box value to text3 then label's value should change to text3

    as i am a newbie here
    and sorry for bad english

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Apr 2009 Link to this post


    The code that you used is for setting the text of label which is placed in FooterTemplate of RadComboBox on changing the selection. I tried your code and it is working fine in my end (works only if you add FooterTemplate).

    If you are trying to set the selected item text to label outside the RadCombobox, then you can try following code for that.


    <telerik:radcombobox id="RadComboBox1" runat="server" OnClientSelectedIndexChanged="calc">  
    <asp:Label ID="LabelFooter" Text="Text" runat="server"></asp:Label> 
    <telerik:RadComboBoxItem runat="server" Text="Item1" Value="Item1"></telerik:RadComboBoxItem> 
    <telerik:RadComboBoxItem runat="server" Text="Item2" Value="Item2"></telerik:RadComboBoxItem> 
    <telerik:RadComboBoxItem runat="server" Text="Item3" Value="Item3"></telerik:RadComboBoxItem> 
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 


    <script type="text/javascript">  
    function calc(sender,args)  
        var footer = sender._getFooterElement();  //Accessing the label in footer of RadComboBox  
        footer.innerHTML = args.get_item().get_text(); //Setting the text of footer  
        var label = document.getElementById("Label1"); // Access the label with id 'Label1'  
        label.innerText  = args.get_item().get_text(); // Set the text of label  

    I believe the links below will be helpful to you;
    Client-Side Basics
    Client-Side Events


Back to Top