Make sure controller action method parameter
object name not match with any its property.
This is model
public class QuestionModel
{
[Required]
public string Question { get; set; }
}
This is Controller Action method
[HttpPost]
public ActionResult Create(QuestionModel Question)
{
//Add your code here
}
Create method parameter QuestionModel Question object name matching with its property Question.
In this case
when we post data from view to controller ViewModel returns null.
No comments:
Post a Comment