issue with form C# mvc

You should create your view like :

@model Yournamespace.Models.ModelName

        @using (Html.BeginForm("MethodName", "ControllerName", FormMethod.Post, new { @class = "css class if any" }))
                <div class="input-block">
                    <strong><label>yOur Label</label></strong>
                    @Html.EditorFor(model => Model.Attribute)
                    <div class="UserIdValidation">
                        @Html.ValidationMessageFor(model => Model.Attribute)

                <p style="margin-top: 25px" class="input-block">
                    <input type="submit" value="Submit">

and your controller action should be like this :

 public class ControllerNameController : Controller
        public ActionResult Login(ModelName model)

              return View("VewName");

Browse More Popular Posts

Leave a Comment