2
Est-ce que quelqu'un peut m'aider à convertir la syntaxe de rasoir suivante en sa syntaxe de rasoir vb.net équivalente?Conversion de la syntaxe du rasoir C# en 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;
}));
})
) --update
je réussi à convertir le code ci-dessus dans les sections, mais maintenant obtenir l'erreur suivante:
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
mon avis converti ressemble à ceci
@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)
)
ou me guider dans la bonne direction sur comment puis-je le convertir? – Baahubali
La syntaxe repose sur un bloc @ {do domething}. Vous pouvez accéder aux objets VB. Si c'est ce que vous demandez. –
Je le sais. J'ai essayé de réécrire ceci dans vb.net mais suis coincé à ItemDataBound (article, catégorie) sur comment puis-je réécrire ceci? Visual Studio n'offre aucune aide intellisense non plus – Baahubali