How to select dropdown item while using Html.DropDownListFor in MVC

Jak
Jak
Member
364 Points
152 Posts

How to select dropdown item while using Html.DropDownListFor in MVC?

Views: 8207
Total Answered: 1
Total Marked As Answer: 0
Posted On: 16-Feb-2015 20:59

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Moderator
1172 Points
211 Posts
         

Hi,

Solve as:

SelectListItem= new SelectListItem();
SelectListItem.Selected = true;
SelectListItem.Text = item.Category;
SelectListItem.Value = item.CategoryShortName;
Model.Category.Add(SelectListItem);

 

Posted On: 17-Feb-2015 21:35
 Log In to Chat