Skip to content

Instantly share code, notes, and snippets.

@tusmester
Created February 8, 2018 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tusmester/53572fb9e765d26f41ddd93c0110ee49 to your computer and use it in GitHub Desktop.
Save tusmester/53572fb9e765d26f41ddd93c0110ee49 to your computer and use it in GitHub Desktop.
#sn #mvc #view #create
@{
ViewBag.Title = "Create task";
}
@using SnWebApplication.Models
@model TaskViewModel
<h2>@ViewBag.Title</h2>
<div class="row">
<div class="col-md-8">
<section id="loginForm">
@using (Html.BeginRouteForm("Default", new RouteValueDictionary
{
{"controller", "Dashboard"},
{"action", "Create"}
}, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
<div class="form-group">
@Html.LabelFor(m => m.DisplayName, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.DisplayName, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.DisplayName, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.AssignedToId, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.DropDownList("AssignedToId",
TaskViewModel.Users.Select(u => new SelectListItem
{
Text = u.DisplayName,
Value = u.Id.ToString(),
Selected = u.Id == SenseNet.ContentRepository.User.Current.Id
}),
null,
new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
}
</section>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment