View
----
@Html.ActionLink("Register here", "RegisterUser", "login", null, new { @class = "openDialog", data_dialog_id = "aboutdialog", data_dialog_title = "register new user" })
Controler
----------
[HttpGet]
public ActionResult RegisterUser()
{
return PartialView("_Register");
}
_Layout Page
<script type="text/javascript">
$(document).ready(function () {
alert("hi");
debugger;
$(".openDialog").on("click", function (e) {
alert("BBH");
e.preventDefault();
$("<div></div>").addClass("dialog").attr("id", $(this).attr("data-dialog-id")).appendTo("body").dialog({
title: $(this).attr("data-dialog-title"),
close: function () { $(this).remove(); },
modal: true,
width: 600,
left: 0,
})
.load(this.href);
});
$(".close").on("click", function (e) {
e.preventDefault();
$(this).closest(".dialog").dialog("close");
});
})
</script>
_partial view: _Register.cshtml
--------------------------------
@model MVC_ERP_APP.Models.RegisterUser
@using (Ajax.BeginForm("RegisterUser", "Login", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "PopUpDiv", OnBegin = "BeginReq", InsertionMode = InsertionMode.Replace, OnSuccess = "SavedData", OnFailure = "ErrorSave" }, new { ID = "registerform" }))
{
<fieldset>
<legend>New User</legend>
<table class="table-bordered">
<tr>
<td>
@Html.LabelFor(model => model.username)
</td>
<td>
@Html.TextBoxFor(model => model.username)
@Html.ValidationMessageFor(model => model.username)
</td>
</tr>
<tr>
<td>
@Html.LabelFor(model => model.password)
</td>
<td>
@Html.TextBoxFor(model => model.password)
@Html.ValidationMessageFor(model => model.password)
</td>
</tr>
<tr>
<td>
@Html.LabelFor(model => model.RegDate)
</td>
<td>
@Html.TextBoxFor(model => model.RegDate)
@Html.ValidationMessageFor(model => model.RegDate)
</td>
</tr>
<tr>
<td>
@Html.LabelFor(model => model.email)
</td>
<td>
@Html.TextBoxFor(model => model.email)
@Html.ValidationMessageFor(model => model.email)
</td>
</tr>
<tr>
<td>
<input type="submit" value="Register" />
</td>
</tr>
</table>
</fieldset>
}
Error
-----
Uncaught TypeError: Object [object Object] has no method 'dialog'
Regards
Basheer Ahamed.B