Hi
public class Location { public Location() { } [Key] [Display(Name = "Id")] public string Id { get; set; } [DataType(DataType.Text)] [RegularExpression(@"^[a-zA-Z'.\s]{1,25}$", ErrorMessage = "Special Characters not allowed")] [Required(ErrorMessage = "Please enter Location"), MaxLength(25)] [Display(Name = "Description")] public string Description { get; set; } [Required] public bool IsActive { get; set; } }
@using (Html.BeginForm("CreateEdit", "Location", FormMethod.Post)) { <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> <h4 class="modal-title"></h4> </div> <div class="modal-body"> @Html.ValidationSummary(false, "", new { @class = "text-danger" }) <div class="form-horizontal"> <div class="form-group row"> <label class="control-label col-sm-3" for="Id">Id</label> <div class="col-sm-9"> <input type="text" class="form-control form-control-sm" id="txtId" name="Id" placeholder="Id" autofocus> </div> </div> <div class="form-group row"> <label class="control-label col-sm-3" for="Description">Description</label> <div class="col-sm-9"> <input type="text" class="form-control form-control-sm" id="txtDescription" name="Description" placeholder="Description"> </div> </div> <div class="form-group row"> <label class="control-label col-sm-3" for="IsActive">Active</label> <div class="form-check col-sm-9"> <input class="form-check-input col-sm-9" type="checkbox" id="IsActive"> <input type="hidden" id="hfIsActive" name="IsActive" /> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-sm btn-default m-r-5" data-dismiss="modal">Cancel</button> <button type="submit" class="btn btn-primary">Save Changes</button> </div> </div> </div> </div> }
Thanks