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
Manav Pandya
NA
19.9k
2.3m
Poperty Error in MVC
Dec 12 2016 5:03 AM
Hello
Today i have faced this error :
The 'phone' property on 'Student' could not be set to a 'System.String' value. You must set this property to a non-null value of type 'System.Int32'.
And my Model class is : Student
[Table("tblStudent")]
public class Student
{
public int StudentId { get; set; }
public string name { get; set; }
public string email { get; set; }
public int phone { get; set; }
}
My Context class : StudentContext
public class StudentContext: DbContext
{
public DbSet<Student> Students { get;set; }
}
My StudentController is shown below :
public ActionResult Index(int id)
{
StudentContext stud = new StudentContext();
Student ss=stud.Students.Single(stu => stu.StudentId == id );
return View(ss);
}
Help me guys in that please soon
Reply
Answers (
7
)
Variable is not adding in the GridView RowBound function
Developing a Website?