Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. @model myApp.Models.NameOfModel
  2.  
  3.  
  4.  
  5. @using (Html.BeginForm())
  6. {
  7. @Html.AntiForgeryToken()
  8.  
  9.  
  10. <div class="form-horizontal">
  11. <h4>ScheduleGroup</h4>
  12. <hr />
  13.  
  14.  
  15. @Html.ValidationSummary(true)
  16.  
  17.  
  18. <div class="form-group">
  19. @Html.LabelFor(model => model.name, new { @class = "control-label col-md-2" })
  20. <div class="col-md-10">
  21. @Html.EditorFor(model => model.name, new { id = "name" })
  22. @Html.ValidationMessageFor(model => model.name)
  23. </div>
  24. </div>
  25.  
  26. <div class="form-group">
  27. @Html.LabelFor(model => model.merchantId, new { @class = "control-label col-md-2" })
  28. <div class="col-md-10">
  29. @Html.EditorFor(model => model.merchantId, new { id = "merchantId" })
  30. @Html.ValidationMessageFor(model => model.merchantId)
  31. </div>
  32. </div>
  33.  
  34.  
  35. <div id="editorRows">
  36. <div class="form-group">
  37. @Html.LabelFor(model => model.begin_date, new { @class = "control-label col-md-2" })
  38. <div class="col-md-10">
  39. @Html.TextBoxFor(model => model.begin_date, new { @Value = ViewBag.startDate, id = "begin_date" })
  40. @Html.ValidationMessageFor(model => model.begin_date)
  41. </div>
  42. </div>
  43.  
  44. <div class="form-group">
  45. @Html.LabelFor(model => model.end_date, new { @class = "control-label col-md-2" })
  46. <div class="col-md-10">
  47. @Html.TextBoxFor(model => model.end_date, new { id = "end_date", @Value = ViewBag.endDate })
  48. @Html.ValidationMessageFor(model => model.end_date)
  49. </div>
  50. </div>
  51. </div>
  52.  
  53. @Html.ActionLink("add date", null, null, new { id = "addItem" })
  54.  
  55.  
  56. <div class="form-group">
  57. <div class="col-md-offset-2 col-md-10">
  58. <input type="submit" value="Create" class="btn btn-default" />
  59. </div>
  60. </div>
  61. </div>
  62. }
  63.  
  64. <script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>
  65. <script>
  66. $(document).ready(function () {
  67.  
  68. var str = '<div class="form-group">' +
  69. '@Html.LabelFor(model => model.begin_date, new { @class = "control-label col-md-2" })' +
  70. '<div class="col-md-10">' +
  71. ' @Html.TextBoxFor(model => model.begin_date, new { @Value = ViewBag.startDate, id = "begin_date" })' +
  72. ' @Html.ValidationMessageFor(model => model.begin_date)' +
  73. '</div>' +
  74. ' </div>' +
  75.  
  76. ' <div class="form-group">' +
  77. ' @Html.LabelFor(model => model.end_date, new { @class = "control-label col-md-2" })' +
  78. ' <div class="col-md-10">' +
  79. ' @Html.TextBoxFor(model => model.end_date, new { id = "end_date", @Value = ViewBag.endDate })' +
  80. ' @Html.ValidationMessageFor(model => model.end_date)' +
  81. ' </div>' +
  82. ' </div>';
  83.  
  84. $("#addItem").click(function () {
  85. $.ajax({
  86. url: this.href,
  87. cache: false,
  88. success: function (html) { $("#editorRows").append(str); }
  89. });
  90. return false;
  91. });
  92. });
  93. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement