Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear ...

I have don't call particular validation in my web Page.
My class file.
XML
public partial class AssessmentReporttext
    {
        public int ID { get; set; }
        [Required(ErrorMessage = "Assessment is required")]
        public string Assessment { get; set; }
        [Required(ErrorMessage = "Codetype is required")]
        public string CodeType { get; set; }
        [Required(ErrorMessage = "Description is required")]
        public string Description { get; set; }
        [Required(ErrorMessage = "Score is required")]
        public string Score { get; set; }
        public Nullable<System.DateTime> CreateDate { get; set; }
        public Nullable<System.DateTime> ModifiedDate { get; set; }
    }


And From Code..
@using (Html.BeginForm())
{


@Html.LabelFor(model => model.Assessment)


@*@Html.EditorFor(model => model.Assessment)*@
@Html.DropDownList("Assessment", new SelectList(Enum.GetValues(typeof(MovingCorrectly.Common.CommonEnums.ReportAssessmentType))), "Select")
@Html.ValidationMessageFor(model => model.Assessment, null, new { @class = "redtext" })



@Html.LabelFor(model => model.CodeType)


@*@Html.TextAreaFor(model => model.CodeType, new { cols = "50" })*@
@Html.DropDownList("CodeType", new SelectList(Enum.GetValues(typeof(MovingCorrectly.Common.CommonEnums.Codetype))), "Select")
@Html.ValidationMessageFor(model => model.CodeType, null, new { @class = "redtext" })


@Html.LabelFor(model => model.Score)


@Html.DropDownList("Score", new SelectList(Enum.GetValues(typeof(MovingCorrectly.Common.CommonEnums.ReportScore))), "Select")

@Html.ValidationMessageFor(model => model.Score, null, new { @class = "redtext" })



@Html.LabelFor(model => model.Description)


@Html.TextAreaFor(model => model.Description, new { cols = "50", @maxlength = "1000" })
@Html.ValidationMessageFor(model => model.Description, null, new { @class = "redtext" })




<input type="submit" class="btn btn-primary left" id="submit" value="Submit" />

<input type="button" class="btn btn-danger right" id="submit" value="Cancel" />




}
========
If i am change some value select then fair validation otherwise not fair in validation.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900