本文介绍了我想在MVC4中进行编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在列表绑定在视图中所以我有相同视图中的页面加载时的详细信息我想在我点击编辑按钮时执行编辑 这是我用来在页面加载时显示细节的动作 public ActionResult EditEmployee(int id = 0) { 返回视图(db.Employees.Where(o => o.EmployeeID == id).ToList()); } 这个我正在使用的视图,想在更新时执行编辑(提交)按钮 @foreach(型号中的var项目) { FirstName @ Html.EditorFor(model => item.FirstName) LastName @ Html.EditorFor(model => item.LastName) Title @ Html.EditorFor(model => item.Title) BirthDate @ Html.Ed itorFor(model => item.BirthDate) 地址 @ Html.EditorFor(model => item.Address) City @ Html.EditorFor(model => item.City) < input type =submit value =更新id =更新/> < script type =text / javascript> $(document).ready(function(){ $(。datepicker)。datepicker(); }); }) < / script> } 之后我怎么能调用动作执行编辑解决方案 i'm taking a list to bind in view so i have the details when page loads in the same view i wanna perform edit on when i click on edit buttonthis is the action which i use to show the details when page loads public ActionResult EditEmployee(int id = 0) { return View(db.Employees.Where(o => o.EmployeeID == id).ToList()); }And this the view I'm using and wanna perform edit on update (submit)buttton @foreach (var item in Model) {FirstName @Html.EditorFor(model => item.FirstName)LastName @Html.EditorFor(model => item.LastName)Title @Html.EditorFor(model => item.Title)BirthDate@Html.EditorFor(model => item.BirthDate)Address@Html.EditorFor(model => item.Address)City@Html.EditorFor(model => item.City)<input type="submit" value="Update" id="update" /> <script type="text/javascript"> $(document).ready(function () { $(".datepicker").datepicker(); }); })</script> }after this how can i call the action to perform the edit 解决方案 这篇关于我想在MVC4中进行编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!