开发者

ASP.NET Razor Layout with two Partials, each one with a @Model

In the WebSite (ASP.NET Razor) that I'm doing, I have two PartialViews: Subscribe Newsletter and Contact Form. Each one of this forms has his own @model.

In the Contact Form (with 3 fields: Name, Email and Message), I want to put some validation, and if there are any errors, show it to the user. The problem it's, when I get the erro开发者_开发问答r, I receive an error saying that I cannot deliver the ContactObject to the Newsletter form.

I know that I need to use jQuery and Ajax on this, but I have no clue how can I do this.

Someone can throw me a hand and send me a small example how can I do this with this two partial views?

NOTE: I don't want to create a super-object with both models.

Regards Paulo Aboim Pinto Odivelas - Portugal


Make each partial it's own html form submitting to their own actions. Then it will work as designed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜