C#中的MVC代码

编程入门 行业动态 更新时间:2024-10-25 22:29:20
本文介绍了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"})

推荐答案

每次需要翻译时,您都不必提出这样的问题。大多数(如果不是全部)这项工作都可以自动完成。请参阅我以前的回答:代码解释,C#到VB .NET [ ^ ]。 使用ASP.NET可能需要更多努力,但您仍然可以轻松找出翻译本身。
-SA
You don't have to ask such questions every time you need a translation. Most if not all of this work can be done automatically. Please see my past answer: Code Interpretation, C# to VB.NET[^]. With ASP.NET it may require some more effort, but you still can easily figure out the translation itself.
—SA

@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代码

本文发布于:2023-10-27 03:39:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1532202.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   MVC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!