C# ASP.NET MVC Forms Creating a Basic Form Using Our Models

Dale Sublett
Dale Sublett
13,356 Points

Getting red squiggly lines under @Html and @ViewBag, along with "not used in the current context"

@model Treehouse.FitnessFrog.Models.Entry //this is an example of a strongly typed view using a Model directive

@{ ViewBag.Title = "Add Entry"; }

<h2>@ViewBag.Title</h2>

@using (Html.BeginForm()) {

<div class="row">

<div class="col-md-6">

    <div class="form-group">
        @Html.LabelFor(m => m.Date, new { @class = "control-label" }) <!--used a Lambda expresion -->
        @Html.TextBoxFor(m => m.Date, new { @class = "form-control" })