Dropdown list in mvc3
I have to insert selected drop down list box value and retrieve for update in mvc3 with razor engine so please explain briefly.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 15, 2013, 8:43 PM EST
you can use following code to bide dropdown in MVC 3 with Razor.
public class Role
{
public int RoleId {get;set;}
public int EmployeeId {get;set;}
public string Name {get;set;}
public SelectList RoleSelectList{get;set;}
}
View Side :
@Html.DropDownListFor(m=>m.RoleId, Model.RoleSelectList,"--select--", null)
to retrieve selected value you can use JQuery Post or simple Post form on submit button.
$("#RoleId option:selected").val();
hope this will help you.