कैसे के लिएAsp.Net MVC में DisplayFormat विशेषता के लिए कस्टम त्रुटि संदेश कैसे दिखाएं?
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:d}")]
अपने मॉडल में कोड पीछा कर रहा है एक कस्टम त्रुटि संदेश को दिखाने के लिए,
[Display(Name = "When was that document issued?")]
[DataType(DataType.Date, ErrorMessageResourceName = "DocumentIssueDate_DataType",ErrorMessageResourceType = typeof(CustomErrorMessages))]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:d}")]
public DateTime? DocumentIssueDate { get; set; }
मेरे विचार में जब मैं तारीख पाठ बॉक्स मैं निम्न त्रुटि संदेश मिलता है में 201 दर्ज करें। मैं नीचे दिए गए त्रुटि संदेश को कैसे संशोधित करूं?
मूल्य '201' DocumentIssueDate के लिए मान्य नहीं है।
आप 'DocumentIssueDate_DataType' के लिए क्या है, तो कर सकते हैं? – Eranga
संसाधन फ़ाइल (.resx) में एक स्ट्रिंग संदेश। उदाहरण के लिए "दिनांक डीडी/एमएम/yyyy (उदाहरण के लिए 31/01/1997) के रूप में दर्ज किया जाना चाहिए।" –