How do I handle forms in Site.Master?

I have a partial view thats being rendered in my Site.Master file (footer), and it contains a form - im able to submit values and itll throw it to the controller just fine..the problem is when validation fails and i need to go back to the form to display errors

How can i have a form that uses a viewmodel inside Site.Master and still be able to throw it back and post validation errors?

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>  

I wont be able to inherit using here...i dont think

Thanks

Answers


You could use a strongly typed partial with a form inside then pass the ModelState in TempData and add the errors back into ModelState in the partialview. I would definitely performed client side validation as well.

Another option is to submit the form via Ajax. It is very simple to do with Jquery.Forms.js

http://malsup.com/jquery/form/


Need Your Help

PHP: path is incorrect while running script from cron

php linux cron include filesystems

I'm having a strange problem. When I call script with http request (from browser) it works as it should. But when I'm calling it with cron include starts complaining on paths. Why can paths be ok w...

Build sample data for apache commons Fast Fourier Transform algorithm

java signal-processing fft apache-commons

I wanted to use Apache math commons implementation for FFT (FastFourierTransformer class) to process some dummy data whose 8 data samples are contributing to one complete sinusoidal wave. The maximum

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.