Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @model myApp.Models.NameOfModel
- @using (Html.BeginForm())
- {
- @Html.AntiForgeryToken()
- <div class="form-horizontal">
- <h4>ScheduleGroup</h4>
- <hr />
- @Html.ValidationSummary(true)
- <div class="form-group">
- @Html.LabelFor(model => model.name, new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.name, new { id = "name" })
- @Html.ValidationMessageFor(model => model.name)
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => model.merchantId, new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.merchantId, new { id = "merchantId" })
- @Html.ValidationMessageFor(model => model.merchantId)
- </div>
- </div>
- <div id="editorRows">
- <div class="form-group">
- @Html.LabelFor(model => model.begin_date, new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.TextBoxFor(model => model.begin_date, new { @Value = ViewBag.startDate, id = "begin_date" })
- @Html.ValidationMessageFor(model => model.begin_date)
- </div>
- </div>
- <div class="form-group">
- @Html.LabelFor(model => model.end_date, new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.TextBoxFor(model => model.end_date, new { id = "end_date", @Value = ViewBag.endDate })
- @Html.ValidationMessageFor(model => model.end_date)
- </div>
- </div>
- </div>
- @Html.ActionLink("add date", null, null, new { id = "addItem" })
- <div class="form-group">
- <div class="col-md-offset-2 col-md-10">
- <input type="submit" value="Create" class="btn btn-default" />
- </div>
- </div>
- </div>
- }
- <script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>
- <script>
- $(document).ready(function () {
- var str = '<div class="form-group">' +
- '@Html.LabelFor(model => model.begin_date, new { @class = "control-label col-md-2" })' +
- '<div class="col-md-10">' +
- ' @Html.TextBoxFor(model => model.begin_date, new { @Value = ViewBag.startDate, id = "begin_date" })' +
- ' @Html.ValidationMessageFor(model => model.begin_date)' +
- '</div>' +
- ' </div>' +
- ' <div class="form-group">' +
- ' @Html.LabelFor(model => model.end_date, new { @class = "control-label col-md-2" })' +
- ' <div class="col-md-10">' +
- ' @Html.TextBoxFor(model => model.end_date, new { id = "end_date", @Value = ViewBag.endDate })' +
- ' @Html.ValidationMessageFor(model => model.end_date)' +
- ' </div>' +
- ' </div>';
- $("#addItem").click(function () {
- $.ajax({
- url: this.href,
- cache: false,
- success: function (html) { $("#editorRows").append(str); }
- });
- return false;
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement