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

[Solved] Menu - SiteMap Binding - Vb.Net

0 Answers 18 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
vel
Top achievements
Rank 1
vel asked on 23 Mar 2012, 03:37 PM
Hai,

I Need code for Menu sitemap binding using vb.net.

C# Code In Telerik Demo SIte:
namespace Telerik.Web.Mvc.Examples
{
using System.Web.Mvc;
public partial class MenuController : Controller
{
 
public ActionResult SiteMapBinding()
{
if (!SiteMapManager.SiteMaps.ContainsKey("sample"))
{
SiteMapManager.SiteMaps.Register<XmlSiteMap>("sample", sitmap =>
sitmap
.LoadFrom("~/sample.sitemap"));
}
return View();
}
}
}

I try to convert the telerik demo c# code to vb.net. but "expression does not produce a value" error occured
Converted vb.net Code
Imports System.Web.Mvc
Namespace Telerik.Web.Mvc.Examples
Public Partial Class MenuController
Inherits Controller
Public Function SiteMapBinding() As ActionResult
If Not SiteMapManager.SiteMaps.ContainsKey("sample") Then

SiteMapManager.SiteMaps.Register(Of XmlSiteMap)("sample", Function(sitmap) sitmap.LoadFrom("~/sample.sitemap"))

End If
Return View()
End Function
End Class
End Namespace

Please rectify the error. and give me the sample code for bind menu using sitemap in vb.net.
Tags
Menu
Asked by
vel
Top achievements
Rank 1
Share this question
or