Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > TreeView > Get the client id using javascript in user control i.i ascx

Not answered Get the client id using javascript in user control i.i ascx

Feed from this thread
  • Qaja Mohiddin avatar

    Posted on Jun 12, 2009 (permalink)

    Hi
    I am have a combo with a treeview in it, i need to find the selected node and i am able to do this in aspx page, but the same function fails in .ascx page.
    The below is the function which i am calling in client side.

    function

     

    radPricingLevelTree_ClientNodeClicked(sender, eventArgs)

     

    {

     

    var node = eventArgs.get_node();

     

     

    var comboBox = $find("<%= radPricingLevelCombo.ClientID %>");

     

     

    comboBox.set_text(node.get_text());

    comboBox.trackChanges();

    comboBox.get_items().getItem(0).set_value(node.get_text());

    comboBox.commitChanges();

    comboBox.hideDropDown();

    }
    Pls help

    Reply

  • Veselin Vasilev Veselin Vasilev admin's avatar

    Posted on Jun 15, 2009 (permalink)

    Hi Qaja Mohiddin,

    You need to find the proper id of the combobox like this:

    function radPricingLevelTree_ClientNodeClicked(sender, eventArgs) 
       ... 
       var comboID = sender.get_id().replace("_i0_radPricingLevelTree"""); 
       var comboBox = $find(comboID); 
       .... 


    Best wishes,
    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Greg avatar

    Posted on Feb 2, 2011 (permalink)

    I am doing the same, but in a different manner.

    I am using the radsplitter expand/collapse.

    The problem is in one Radpane the radgrid is fixed & paged so when we collpase the bottom RadPane there is a void.
    I want to change the attributes of the radGrid to show more rows to fill in the void as well as return it back when the splitter is expanded halfway up the page.

    I'm using the collapse/expand event of the radpane to trigger the function that will change the events.
    Right now the only thing I get is [object].  if I add tagname to it is says "Div"

    This is while using <%=control.clientid=>  which I will include here.

    The example above is okay if the sender is what you are looking for, but I'm looking for a different control where we would normally use getelementid().


    Thanks


    This is the test code for me to bring back the id of the control.


    <

     

    script language="javascript" type="text/javascript">
        function RadPaneCollapsed() {
            var dnetGrid;dnetGrid = document.getElementById('<%=grdcontrol.ClientID%>');
            if (dnetGrid != null) {
            alert(dnetGrid.tagName);
        }
        else {
            alert(
    "No ID");
        }
    }
    </script>

     

    Reply

  • Rachana avatar

    Posted on May 17, 2012 (permalink)

    my java script function is below am calling this function in "OnClientSelectedIndexChanging" event in rad combobox ...how to get client id instead of <%= %>,if i'll get id like below it was showing the error in the master page  i.e  The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>) 
    note: i am using  related combobox's,mainly am using this concept is to avoid post backs.. refer the following link
     demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx
    1.I have 4 combobox's.... "OnClientSelectedIndexChanging"  event of 1st combobox  am calling the below function and getting the second combobox client ID
    2.if no data exist in the dataset to bind to the 2nd combo box .how to display for 2nd, 3rd and 4th combobox there is  no data exists.
    if i use object.clearItems(); or clear selection(); it is showing null exception
     
    function LoadInstitutionList(sender, eventArgs) {
                   var item = eventArgs.get_item();
                   var CboTerm = $find("<%= RadCbocountry.ClientID %>");
                   CboTerm.set_text("loading.........");
                   if (item.get_index() >= 0) {
                       CboTerm.requestItems(item.get_value(), false);
                   }
                   else {
                       CboTerm.set_text(" ");
                       CboTerm.clearItems();
                   }
               }

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > TreeView > Get the client id using javascript in user control i.i ascx
Related resources for "Get the client id using javascript in user control i.i ascx"

ASP.NET TreeView Features  |   Documentation   |  Demos  |  Step-by-step Tutorial  ]