MVC3- PartialViewResult as a Modal Dialog

Today we will see how we can display partial view result as a modal dialog

The partial view

 @model ReloadPartial.Models._UserModel  

@using (Html.BeginForm("Validation","Home", FormMethod.Post, new { id = "UsrValidation" }))



@Html.Raw("User Name:")

@Html.TextBoxFor(m => m.UserName)


@Html.TextBoxFor(m => m.Email)


Now lets see the controller  implementation

 public PartialViewResult Validation(_UserModel model)  
ModelState.Clear(); //important to see changes in UI
if (ModelState.IsValid)
//Can perform any action
return PartialView("_User",model);


function SubmitForm() {
//select and serialize our small form
var frm = $("#UsrData").serialize();
// get form action
var action = $("#UsrData").attr("action");
url: action, // or '@(Url.Action("Validation"))',
cache: false,
async: true,
type: "POST",
data: frm, //data to post to server
error: function (html) { alert(html); }, //something goes wrong...
success: function (data) {
function showDialog(data) {
modal: true,
title: "Details",
resizable: false,
open: true,
height: 150,
width: 200,
position: 'center',
buttons: [{ text: "Ok", click: function () {

Published by Nirbhay

Technology Geek,Blogger,Reviewer

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: