这个剃刀语法的VB.NET等价是什么?

时间:2013-11-13 22:09:15

标签: asp.net-mvc razor

我真的遇到了lambda表达式的问题。

@model CalculateSimpleInterest.Models.SimpleInterestModel

@{
    ViewBag.Title = "SimpleInterest";
}
<h2>Calulate Simple Interest</h2>@using (Ajax.BeginForm("CalculateSimpleInterestResult","CalculateSimpleInterest",
                            new AjaxOptions { UpdateTargetId = "divInterestDeatils" }))
    {

    <fieldset>
        <legend>Calulate Simple Interest</legend><div id="div1"></div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Amount)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Amount)          
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Rate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Rate)          
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Year)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Year)           
        </div>
        <p>
            <input type="submit" value="Calculate" />
        </p>
    </fieldset>
 }

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

1 个答案:

答案 0 :(得分:0)

您正在寻找的语法是

@Html.YourHelperFor(Function(model), model.Property)

例如

<div class="editor-label">
    @Html.LabelFor(Function(model), model.Amount)
</div>