How to get reference to RadComboBox with JQuery in different page

3 posts, 0 answers
  1. Matthew
    Matthew avatar
    7 posts
    Member since:
    Jan 2018

    Posted 05 Dec 2018 Link to this post

    I need to access a RadComboBox that is defined in one .ascx file from a different .ascx file so that I can get/set values in it.  I've read this information https://docs.telerik.com/devtools/aspnet-ajax/general-information/get-client-side-reference#using-jquery-selectors but it isn't working.  All help is greatly appreciated.  Here are the details about what I have:

     

    In View.ascx the control is specified:

    <telerik:RadComboBox RenderMode="Lightweight" ID="cmbReportTool" filter="Contains" runat="server"
             oWrap="false" class="cmb-report-tool"  CheckBoxes="true" EnableCheckAllItemsCheckBox="true" width="400px">
    </telerik:RadComboBox>

    and the following JavaScript exists in a different .ascx file:

    function () {

        var combo = $telerik.$("[id$='cmbReportTool']").get(0).control;

    }

    I've played around with the JS and used an alert() to quickly see what I have.  The following code presents "combo: [object HTMLDivElement]"

    function () {
        var combo = $telerik.$("[id$='cmbReportTool']").get(0);

    alert('combo: ' + combo);
    }

     

    The following code presents "combo: undefined"

    function () {
        var combo = $telerik.$("[id$='cmbReportTool']").get(0).control;
    alert('combo: ' + combo);
    }

     

    Here are some specifics about my environment:

    OS: Windows 7 Enterprise with service pack 1
    Browser: Internet Explorer 11
    Telerik Web UI version 2016.3.1027.40

  2. Rumen
    Admin
    Rumen avatar
    14417 posts

    Posted 10 Dec 2018 Link to this post

    Hello Matthew,

    Please find attached a video demonstrating how to inspect the rendered HTML by the control, how to obtain the ID and use it in order to get reference to the control regardless of whether it is accessed from an aspx/ascx or another page.

    Regards,
    Rumen
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Matthew
    Matthew avatar
    7 posts
    Member since:
    Jan 2018

    Posted 30 Dec 2018 in reply to Rumen Link to this post

    Thank you for your help.
Back to Top