1

System.Web.Mvc.AjaxHelper 不包含“BeginForm”的定义我在我的 mvc3 项目中遇到此错误请帮我解决这个问题

这是我的代码:

@{
    ViewBag.Title = "Register";
    Layout = "~/Views/Shared/_MyLayout.cshtml";
}
@model FoodMart.Models.AccountModel
@using (Ajax.BeginForm("Register", new AjaxOptions { UpdateTargetId = "result" }))
{   
<div id="result" style="width:800px">    
<fieldset style="width:100%">
<legend><span style="font-size:larger; color:Green; font-family:Arial">Register Here</span></legend>
 <table style="width:100%">
 <tr>
 <td>@Html.LabelFor(m => m.users.FirstName,"Enter First Name")</td>
 <td>@Html.TextBoxFor(m => m.users.FirstName, new { style = "width:150px" })</td>
 <td><span style="font-size:medium; color:Green;">@Html.ValidationMessageFor(m=>m.users.FirstName)</span></td>
 </tr>
 <tr>
 <td>@Html.LabelFor(m => m.users.Landline)</td>
 <td>@Html.TextBoxFor(m => m.users.Landline, new { style = "width:150px" })</td>

 </tr>

 <tr>
 <td><input type="submit" value="Register" /></td>
 <td></td>
 </tr>

 </table>
</fieldset>
</div>    
}
4

2 回答 2

1

AjaxHelper.BeginForm是在命名空间中定义的扩展方法System.Web.Mvc.Ajax

web.config您的文件夹中是否定义了此命名空间Views

于 2012-12-15T07:25:56.817 回答
0

您是否尝试在视图顶部插入此指令?

@using System.Web.Mvc.Ajax
于 2014-01-02T11:04:50.800 回答