MVC-3 and Html.Serialize (ASP.NET 4, MVC3)

2019-06-17 18:18发布

Currently working on a project in MVC-3. Trying to put the following code in my view, but Visual Studio is telling me it can't find the Serialize method.

@Html.Serialize("User",Model)

(ex)

@using (Html.BeginForm())
{

 @Html.Serialize("User",Model)
    <fieldset>
...
    </fieldset>
}

Is this feature missing in MVC-3? I see examples of people using it in MVC-2. Perhaps there is a new way of handling this issue?

4条回答
SAY GOODBYE
2楼-- · 2019-06-17 18:41

Html.Serialize is in the Futures assembly.

查看更多
看我几分像从前
3楼-- · 2019-06-17 18:44

Serialize() is not listed here.

It is not a part of Sys.Web.Mvc, but is for now part of Microsoft.Web.Mvc:

查看更多
啃猪蹄的小仙女
4楼-- · 2019-06-17 18:51

I downloaded the futures, removed reference to its local System.Web.Mvc (v3), and added the release version from GAC, and included the new futures DLL in project.

查看更多
走好不送
5楼-- · 2019-06-17 18:52

Install the Nuget package: Install-Package Mvc3Futures.

On your view, add a reference to namespace Microsoft.Web.Mvc, then you can use Html.Serialize.

查看更多
登录 后发表回答