Saturday, 15 March 2014

c# - Handle validation of EF in windows form application -



c# - Handle validation of EF in windows form application -

i working ef6 create model .so create comment model can see here . commenttext set required error message .when utilize mvc ,it works fine , errors comes , showed ,but don't know how can handle error in c# win forms .i mean when user leaves textbox empty error should showed .but don't know how can access error message ?

best regards

public partial class comment { [displayname("شناسه نظر")] public int id { get; set; } [required(errormessage = "متن نظر را وارد کنید")] [displayname("متن نظر")] public string commenttext { get; set; } public virtual icollection<comment> comments { get; set; } public virtual comment comment1 { get; set; } public virtual pupil student { get; set; } public virtual content content { get; set; } }

the attributes mvc feature only. if wan't in web forms application, have utilize requiredvalidator command , set message in that. must in aspx or ascx file.

c# asp.net-mvc entity-framework validation

No comments:

Post a Comment