本文介绍了C#中的MVC代码 - 什么是VB等价?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是转换为VB时遇到问题的c#代码:
Here's the c# code that I am having trouble converting to VB:
<div class="form-group">
@Html.LabelFor(m => m.FromName, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.FromName, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.FromName)
</div>
</div>
我遇到问题的c#行就是那些带有@Html语法的行。
我有的那些VB代码(下面)有这个错误m.FromName:
后期绑定操作无法转换为表达式树
这是我在VB中所拥有的:
The c# line I'm having trouble with is those ones with @Html syntax.
The VB code (below) that I have for those has this error on m.FromName:
"Late binding operations cannot be converted to an expression tree"
Here's what I have in VB:
@Html.LabelFor(Function(m) m.FromName, New With {Key .class = "col-md-2 control-label"})
推荐答案
@Html.LabelFor(m => m.FromName, new { @class = "col-md-2 control-label" })
<label for="FromName">From Name</label>
@Html.TextBoxFor(m => m.FromName, new { @class = "form-control" })
<input type="text" class="from-control" name="FromName" id="FromName">
</input>
等效的HTML代码写在剃刀下面代码 - 现在将其转换为VB语法。
-KR
Equivalent HTML code is written below the razor code - Now convert it to your VB syntax.
-KR
这篇关于C#中的MVC代码 - 什么是VB等价?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!