Skip to content

Instantly share code, notes, and snippets.

@jholland918
Created August 25, 2016 19:30
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 jholland918/c777d39e85c7d13feb74b3d25dc44d62 to your computer and use it in GitHub Desktop.
Save jholland918/c777d39e85c7d13feb74b3d25dc44d62 to your computer and use it in GitHub Desktop.
MvcStuff
@model eBowlingFramework.Models.Foo
@{
ViewBag.Title = "Create";
}
<h2>Create</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Foo</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.Bar, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Bar, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Bar, "", new { @class = "text-danger" })
</div>
</div>
@for (int i = 0; i < Model.Grunts.Count(); i++)
{
<div class="editor-label">
@Html.Label("Grunts[" + i + "].Yelp", Model.Grunts[i].Yelp)
</div>
<div class="editor-field">
@Html.Editor("Grunts[" + i + "].Yelp")
</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>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
namespace eBowlingFramework.Models
{
public class Foo
{
public string Bar { get; set; }
public List<Grunt> Grunts { get; set; }
}
}
namespace eBowlingFramework.Models
{
public class Grunt
{
public string Yelp { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment