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

Jak
Jak
Member
352 Points
151 Posts

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

Views: 8136
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
1170 Points
210 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
banner

Blog

Active User (2)

 Log In to Chat