Getting access to client side api dynamically?

3 posts, 0 answers
  1. C
    C avatar
    43 posts
    Member since:
    Jul 2013

    Posted 30 Mar 2015 Link to this post


    I have a RadTooltipManager, containing a web user control (WUC). This WUC in turn contains a number of telerik controls. Among these controls, a RadButton and a RadCalendar. I want to have access to this RadCalendar's selected date property on the client, when clicking the RadButton.

    So if I tie an OnClientClicked event to the button and put this event in the WUC. I get a reference error. I'm assuming this is because the <script> portion of the WUC isn't loaded when the button is loaded. (I load the control via Page.LoadControl on the containing page).

    If I put the OnClientClicked function on the containing page, it loads just fine. Then comes, however, the problem of referring to the RadCalendar contained in the tooltip and WUC. Usually I'll do a $find() and enter the contorlname.ClientID, but that will give an error here, as the containing page is aware of no such control.

    So my next idea was to use the telerik static client side library to get a reference to the control in question. And this seems to work! If I do a $telerik.radControls, I get an array of all the loaded controls on the page. Which seems to include those in the WUC.

    How do I get access to the Telerik client side library from one of these objects?
  2. Marin Bratanov
    Marin Bratanov avatar
    4653 posts

    Posted 30 Mar 2015 Link to this post


    Scripts added to the page during an AJAX request are not parsed by the browser, so you get the error. Such scripts must be registered according to the MS AJAX needs.

    I am attaching here a basic example that shows how you can utilize the findControl() method as a reference.


    Marin Bratanov

    See What's Next in App Development. Register for TelerikNEXT.

  3. C
    C avatar
    43 posts
    Member since:
    Jul 2013

    Posted 30 Mar 2015 in reply to Marin Bratanov Link to this post

    Thanks a whole lot!
Back to Top