This is a migrated thread and some comments may be shown as answers.

RadMenu using the WebService

4 Answers 96 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Guo Huang
Top achievements
Rank 1
Guo Huang asked on 11 Sep 2009, 07:59 PM
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

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 15 Sep 2009, 01:42 PM
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.
0
Guo Huang
Top achievements
Rank 1
answered on 15 Sep 2009, 11:03 PM
Hi Albert

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

Thanks again.
0
Guo Huang
Top achievements
Rank 1
answered on 20 Oct 2009, 06:22 PM
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

0
T. Tsonev
Telerik team
answered on 26 Oct 2009, 07:33 AM
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.
Tags
Menu
Asked by
Guo Huang
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Guo Huang
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or