有人可以帮我将以下 razor 语法转换为等效的 vb.net razor 语法吗?
@(Html.Kendo().Menu()
.Name("menu") //The name of the menu is mandatory. It specifies the "id" attribute of the widget.
.BindTo(Model, mappings =>
{
mappings.For<category>(binding => binding //define first level of menu
.ItemDataBound((item, category) => //define mapping between menu item properties and the model properties
{
item.Text = category.CategoryName;
})
.Children(category => category.Products)); //define which property of the model contains the children
mappings.For<product>(binding => binding
.ItemDataBound((item, product) =>
{
item.Text = product.ProductName;
}));
})
) - 更新
我已设法分段转换上述代码,但现在出现以下错误:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30561: 'Html' is ambiguous, imported from the namespaces or types 'System.Web.WebPages, System.Web.Mvc, Kendo.Mvc.UI'.
Source Error:
Line 2: @ModelType IEnumerable(Of MenuCategory)
Line 3:
Line 4: @(Html.Kendo().Menu() _
Line 5: .Name("TestMenu") _
Line 6: .BindTo(Model, Sub(mappings)
Source File: C:\Documents and Settings\vivekba\my documents\visual studio 2010\Projects\test\test\Views\Home\TestMenu.vbhtml Line: 4
我转换后的视图看起来像这样
@Imports test.Models
@ModelType IEnumerable(Of TestMenuCategory)
@(Html.Kendo().Menu() _
.Name("TestMenu") _
.BindTo(Model,
Sub(mappings)
mappings.For(Of TestMenuCategory)(
Sub(x)
x.ItemDataBound(
Sub(item, menu)
item.Text = menu.Name
End Sub) _
.Children(
Function(menu)
Return menu.SubItem
End Function)
mappings.For(Of TestMenuItem)(Sub(bindings)
bindings.ItemDataBound(Sub(testItem, menuItem)
testItem.Text = "test"
End Sub)
End Sub)
End Sub)
End Sub)
)