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

4 posts, 0 answers
  1. Qaja Mohiddin
    Qaja Mohiddin avatar
    7 posts
    Member since:
    May 2006

    Posted 12 Jun 2009 Link to this post

    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.



    radPricingLevelTree_ClientNodeClicked(sender, eventArgs)




    var node = eventArgs.get_node();



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








    Pls help

  2. Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 15 Jun 2009 Link to this post

    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.
  3. Greg
    Greg avatar
    12 posts
    Member since:
    Jul 2008

    Posted 02 Feb 2011 Link to this post

    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().


    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) {
        else {
    "No ID");


  4. Rachana
    Rachana avatar
    18 posts
    Member since:
    Jul 2011

    Posted 17 May 2012 Link to this post

    my java script function is below am calling this function in "OnClientSelectedIndexChanging" event in rad combobox 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
    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 %>");
                   if (item.get_index() >= 0) {
                       CboTerm.requestItems(item.get_value(), false);
                   else {
                       CboTerm.set_text(" ");
Back to Top