RadPanelBar javascript/jquery issue

7 posts, 0 answers
  1. RvdGrint
    RvdGrint avatar
    112 posts
    Member since:
    May 2011

    Posted 17 Jan 2012 Link to this post

    Hello,

    I've a RadPanelBar on a dynamiclly loaded UserControl. In that UserControl I've placed a RadScriptBlock where my javascript functions are defined. I'm trying to execute the get_element() and/or get_items() functions but I always get the error that the function is not supported.
    var $ = $telerik.$;
     
    var categoryPanelBar = $(this).find("<%=RadPanelBar1.ClientID%>");
     
    alert(categoryPanelBar.get_items());

    With this code the PanelBar object can be found only the function get_items() will not be excuted because it tells me that this function is not support for the element.

    Can someone help me with this?

    Regards,
      Jos Meerkerk,
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 20 Jan 2012 Link to this post

    Hello Jos,

    You get the following error since the jQuery find method accepts either a selector, a jQuery object or an element while in your case you use none of the just mentioned ones. However, using the following code you can achieve the desired effect:
    <telerik:RadScriptBlock runat="server" ID="block1">
        <script type="text/javascript">
            function pageLoad() {
                var categoryPanelBar = $find("<%=RadPanelBar1.ClientID%>");
                var item = categoryPanelBar.findItemByText("item1");
                item.disable();
            }
        </script>
    </telerik:RadScriptBlock>

    Please note that we would recommend that you use our flexible client-side API.

    Regards,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. RvdGrint
    RvdGrint avatar
    112 posts
    Member since:
    May 2011

    Posted 20 Jan 2012 Link to this post

    Kate,

    thnx for your reply but unfortunately this doesn't work.

    When I use:
    var categoryPanelBar = $find("<%=RadPanelBar1.ClientID%>");

    then categorypPanelBar is null

    But when I use:

    var categoryPanelBar = $(this).find("<%=RadPanelBar1.ClientID%>");

    an [object] is found

    But stil the methods are not valid for the object.

    The problem occurs with implementing the Telerik Schedule example with WebServices (http://demos.telerik.com/aspnet-ajax/scheduler/examples/webservice/defaultcs.aspx) on a Dynamiclly loaded User Control.

    Regards,
      Jos

     

     

     

  5. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 21 Jan 2012 Link to this post

    Hello Jos,

    Please refer to the attached runnable page that works as expected from my end (I can find the RadPanelBar object and access its properties). Can you modify it in a way so that it demonstrates the issue so I can help you out?

    All the best,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  6. RvdGrint
    RvdGrint avatar
    112 posts
    Member since:
    May 2011

    Posted 23 Jan 2012 Link to this post

    Kate,

    as mentioned before my User Control is loaded dynamically. Could that be the difference??
    I will try you're example.

    Regards,
      Jos Meerkerk
  7. RvdGrint
    RvdGrint avatar
    112 posts
    Member since:
    May 2011

    Posted 23 Jan 2012 Link to this post

    Kate,

    with your example everything work's fine. Is there an explanation for the fact that things do not work when implementing it in my application?

    Regards,
      Jos
  8. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 25 Jan 2012 Link to this post

    Hello Jos,

    Attached is a sample project which uses the following approach to find a client object of a control which is placed inside a user control:
    function pageLoad() {
        var paneljQuery = $telerik.$("[id$='_RadPanelBar1']");
        var panelBarObj = $find(paneljQuery.attr("id"));
        alert("The PanelBar Object: " + panelBarObj.get_id());
        alert("The number of items: " + panelBarObj.get_items().get_count());
    }
    var paneljQuery = $telerik.$("[id$='_RadPanelBar1']"); -- finds the jQuery object of a control which ID ends on the '_RadPanelBar1' string.

    $find(paneljQuery.attr("id")); -- finds the client object of the control which ID is passed as a parameter.

    I hope this helps.

    Greetings,
    Ivana
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017