Hi
public Location()
{
}
[Key]
[Required]
[RegularExpression(@"^[a-zA-Z'.\s]{1,4}$", ErrorMessage = "Special Characters not allowed")]
[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; }
}
********************************************************************************
@model MyApplication.Models.Location
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
@using (Html.BeginForm("CreateEdit", "Location", FormMethod.Post, new { @id = "locationFormId", @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
}
Thanks

Sachin SinghRank #66 · 26.2K reputationPosted Jun 15, 2021, 4:37 AM EDT
Balaji Saravanan63 reputationPosted Jun 15, 2021, 4:07 AM EDT