studentForm.cshtml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. @{;
  2. ViewBag.Title = "表单页面";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <script>
  6. var keyValue = request('keyValue');
  7. $(function () {
  8. initControl();
  9. });
  10. //初始化控件
  11. function initControl() {
  12. //获取表单
  13. if (!!keyValue) {
  14. $.SetForm({
  15. url: "../../BaseManage/student/GetFormJson",
  16. param: { keyValue: keyValue },
  17. success: function (data) {
  18. $("#form1").SetWebControls(data);
  19. }
  20. })
  21. }
  22. }
  23. //保存表单;
  24. function AcceptClick() {
  25. if (!$('#form1').Validform()) {
  26. return false;
  27. }
  28. var postData = $("#form1").GetWebControls(keyValue);
  29. $.SaveForm({
  30. url: "../../BaseManage/student/SaveForm?keyValue=" + keyValue,
  31. param: postData,
  32. loading: "正在保存数据...",
  33. success: function () {
  34. $.currentIframe().$("#gridTable").trigger("reloadGrid");
  35. }
  36. })
  37. }
  38. </script>
  39. <div style="margin-top: 20px; margin-right: 30px;">
  40. <table class="form">
  41. <tr>
  42. <td class="formTitle">姓名</td>
  43. <td class="formValue">
  44. <input id="name" type="text" class="form-control" />
  45. </td>
  46. <td class="formTitle">性别</td>
  47. <td class="formValue">
  48. <input id="sex" type="text" class="form-control" />
  49. </td>
  50. </tr>
  51. </table>
  52. </div>