Dropdown in asp.net mvc
I have a dropdown in my asp.net mvc application, when am submitting a page, I have to display that dropdown text in my application and the value in the db.
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 attend5days leftRegister
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted May 1, 2015, 10:21 PM EDT
http://www.c-sharpcorner.com/Forums/Thread/295319/
The replies that i've posted should help you get started.
Santhakumar MunuswamyRank #128 · 17.3K reputationPosted May 1, 2015, 10:27 PM EDT
First you have to bind data like Text, Value on dropdownlist
Ex.
Dropdownlist1.DataSource=ds.Tables[0].DefaultView;
Dropdownlist1.DataValueField="EmpId";
Dropdownlist1.DataTextField="EmpName";
Dropdownlist1.DataBind();
you can get selected dropdwonlist text and value as below
string text=Dropdownlist1.SelectedItem.Text;
string value=Dropdwonlist1.SelectedItem.Value;
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted May 1, 2015, 10:40 PM EDT
Jithil JohnRank #2,791 · 506 reputationPosted May 1, 2015, 11:10 PM EDT
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted May 1, 2015, 11:29 PM EDT
Jithil JohnRank #2,791 · 506 reputationPosted May 2, 2015, 12:46 AM EDT
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted May 2, 2015, 3:41 AM EDT
What portion in the code that you don't understand? If you are new to MVC then I will suggest you to start at the basic first before you go any further
http://www.asp.net/mvc
Munesh SharmaRank #174 · 13.9K reputationPosted May 2, 2015, 3:41 AM EDT
http://www.c-sharpcorner.com/uploadfile/2124ae/saving-dropdownlist-selected-value-across-postback-in-mvc/
Santhakumar MunuswamyRank #128 · 17.3K reputationPosted May 2, 2015, 10:25 PM EDT
Refer
http://www.codeproject.com/Tips/806845/Dynamic-DropDownList-Binding-in-ASP-NET-MVC-With-D