RadMenu using the WebService

5 posts, 0 answers
  1. Guo Huang
    Guo Huang avatar
    6 posts
    Member since:
    Sep 2009

    Posted 11 Sep 2009 Link to this post

    Hi

    I am using RadMenu and binding data with WebService. i would like to call the webservice (or bind data on the clientside) when the radmenu is loaded instead of mouseover, can i do that?

    I have done a lot of researches before i ask this question, but i don't see any examples to preload radmenu with webservice.

    Thanks
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 15 Sep 2009 Link to this post

    Hello Guo Huang,

    Currently there is no public API which would allow you to preload the items. However you can use the private
    _loadChildrenFromWebService method of the RadMenuItem client-side object. When the page loads you can traverse the items and call that method:

    <script type="text/javascript">
    function pageLoad() {
          var menu = $find("<%= RadMenu1.ClientID%>");
          for (var i = 0; i < menu.get_items().get_count(); i++) {
                 var item = menu.get_items().getItem(i);
                 item._loadChildrenFromWebService();
          }
    }
    </script>

    Regards,
    Albert,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Guo Huang
    Guo Huang avatar
    6 posts
    Member since:
    Sep 2009

    Posted 15 Sep 2009 Link to this post

    Hi Albert

    Thanks for the script, exactly what i needed. I will give it a try.

    Thanks again.
  4. Guo Huang
    Guo Huang avatar
    6 posts
    Member since:
    Sep 2009

    Posted 20 Oct 2009 Link to this post

    Hi Albert

    if i want to bind the menu using the following code, what javascript method should i call to populate data from the wcf service?

    <tlrk:RadContextMenu ID="RadMenu2" runat="server" Flow="Vertical" Skin="Office2007" EnableViewState="false">
    <Targets>
    <tlrk:ContextMenuElementTarget ElementID="view1" />
    </Targets>
    <WebServiceSettings Method="LoadData" Path="GetRadMenu.svc" />
    <DataBindings>
    <tlrk:RadMenuItemBinding Depth="0" ExpandMode="WebService" />
    </DataBindings>
    </tlrk:RadContextMenu>

    Thanks

  5. T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 26 Oct 2009 Link to this post

    Hello,

    Currently RadMenu and RadContextMenu support Web Service loading only for sub-items. The root items must be created manually.

    Root items can be manipulated on the client-side and you can manually populate them from a WS, but the easier option would be to place them in a sub-item. You can then use the code snippet to preload them if needed.

    Regards,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top