I am creating a Create,Edit,Delete application for simple one table.
I have Create get method
and create post method
views ready as i created my project using entity framework.
now in my current application it is opening a new page to create new data and what i want is to open a pop up in which I add required fields and than when I click on ADD it will add those data in database.
FloorFactorsController.cs
public PartialViewResult Create()
{
return PartialView();
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "FloorFactorPercentage,FromDate,ToDate")] FloorFactor floorFactor)
{
if (ModelState.IsValid)
{
db.FloorFactors.Add(floorFactor);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(floorFactor);
}
Index view.cshtml required part of full code.`
Here, I have add ajax.actionlink for adding an CREATE NEW link which redirect to my get method create
in controller class. I have added all required .css and js files i.e. jquery.js, dialog.js,dialog.css etc.
<p>
@Ajax.ActionLink("Create New", "Create", new AjaxOptions { HttpMethod = "Get" ,UpdateTargetId = "result", InsertionMode = InsertionMode.Replace, OnSuccess = "openPopup" }) <br />
</p>
<div id="result" style="display:none;">
<button type="button">success</button>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#result").dialog({
autoOpen: false,
title: 'Title',
width: 500,
height: 'auto',
modal: true
});
});
function openPopup() {
$("#result").dialog("open");
}
</script>
`
It Gives error
Object doesn't support property or method 'dialog'
I don't know what to do i have referred this QUESTION but this is not working for me.
EDIT _layout.cshtml File
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
<link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
<link href="~/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="~/Scripts/modernizr-2.6.2.js"></script>
<script type="text/javascript" src="~/Content/jquery-2.2.3.js"></script>
<link type="text/css" href="~/Content/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="~/Content/jquery-ui.js"></script>
<script src="~/Content/dialog.js"></script>
<link href="~/Content/dialog.css" rel="stylesheet" />