首先,我要说的是,在使用javascript时,我总是说道,这是我第一次在项目中使用弹出窗口。
直到现在我这样做了(索引视图):
<button type="button" class="btn btn-info btn-xs" data-toggle="modal" data-target="#enquirypopup">Add Event</button>//Table with the list of entries.
<div id="enquirypopup" class="modal fade in" role="dialog" tabindex="-1">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content row">
<div class="modal-header custom-modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Add Event</h4>
</div>
<div class="modal-body">
//This is only a bit off what I have tried
@*<form name="info_form" class="form-inline" action="#" method="post">*@
@*<form name="info_form" class="form-inline" action="Project/Areas/User/Events/Add" method="post">*@
@*<form name="info_form" class="form-inline" action="@Url.Action("Index", "Events")" method="post">*@
@*<form name="info_form" class="form-inline" action="@Url.Action("Add")" method="post">*@
<form name="info_form" class="form-inline" action="/Events/Add" method="post">
<div class="form-group col-sm-12">
<label>Event Title: </label>
<br />
<input type="text" class="form-control" name="Event" id="Event" placeholder="Event Name">
</div>
<br />
<br />
<div class="form-group col-sm-12">
<label>Starting Date and Time: </label>
<br />
<input type="text" class="form-control" name="Start_Date" id="Start_Date" placeholder="ll/zz/aaaa hh:mm:ss">
</div>
<br />
<br />
<div class="form-group col-sm-12">
<label>Ending Date and Time: </label>
<br />
<input type="text" class="form-control" name="End_Date" id="End_Date" placeholder="ll/zz/aaaa hh:mm:ss">
</div>
<br />
<br />
<div class="modal-footer">
@*<div class="form-group col-sm-12">*@
<button type="submit" class="btn btn-success pull-right">Save</button>
@*</div>*@
</div>
</form>
</div>
</div>
</div>
</div>
&#13;
这是控制器:
public ActionResult Index()
{
return View(db.tbl_Event.ToList());
}
[HttpGet]
//public PartialViewResult Add()
public ActionResult Add()
{
//return PartialView("_Event");
return View();
}
[HttpPost]
//public PartialViewResult Add(BOL3.tbl_Event eve)
public ActionResult Add(BOL3.tbl_Event eve)
{
db.tbl_Event.Add(eve);
db.SaveChanges();
//return Add();
//return View("Index");
//return View();
return RedirectToAction("Index", eve);
}
当我将输入的数据保存到弹出窗口时,会显示错误:&#34;视图&#39;索引&#39;或者找不到它的主人,或者没有视图引擎支持搜索到的位置。搜索了以下位置:bla / bla / bla&#34;,但它没有显示索引视图的核心路径。所以这就是我的问题,当我保存数据时,我要关闭弹出窗口以及要在列表中显示的值(索引视图)。请帮助我,因为我已经搜索了许多网站来帮助我这样做,但没有任何对我有用。