TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Debasis Mohapatra
NA
381
57.1k
How to do model field validation in asp.net c# MVC
Jan 15 2019 12:08 AM
Please find the below model code. I want to do field validation. why the viewbag.msg doesn't show the error that [Required(ErrorMessage = "User is required for mobile model details")]
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace SudentRegistration_MVC_Project.Models
{
public class Mobile
{
public int id { get; set; }
public string Mobile_brand { get; set; }
[Required(ErrorMessage = "User is required for mobile model details")]
public string mobile_model { get; set;}
public int mobile_price { get; set; }
public string mobile_description { get; set; }
public List
MobileList { get; set; }
}
}
Reply
Answers (
3
)
Any open source PDFConverter
Content Sharing on Social Media from Website