开发者

VB.NET syntax for EditorFor template?

I tried to create my own templated helpers, but I got stuck on TextBoxFor syntax. In C# it's:

<%= Html.TextBoxFor(model => model) %>  

And I cannot figure开发者_开发知识库 out (or google it) - how to write that in VB.NET?


That looks like standard C# Lambda syntax, so the translation would be:

<%= Html.TextBoxFor( Function (model) model ) %> 

Basically you are giving Html.TextBoxFor a function with 1 parameter. That function doesn't do anything, it just echos the argument back to the caller.

This would require VB 10, which is found in Visual Studio 2010.


You'll need to actually create the template first, but after it is created, you can use it like this:

<%: Html.EditorFor(Function(model) model.YourField)%>       
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜