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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Santhakumar MunuswamyPosted May 3, 2015, 2:25 AM
Refer
http://www.codeproject.com/Tips/806845/Dynamic-DropDownList-Binding-in-ASP-NET-MVC-With-D
Munesh SharmaPosted May 2, 2015, 7:41 AM
http://www.c-sharpcorner.com/uploadfile/2124ae/saving-dropdownlist-selected-value-across-postback-in-mvc/
Vincent Maverick DuranoPosted May 2, 2015, 7:41 AM
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
Jithil JohnPosted May 2, 2015, 4:46 AM
Vincent Maverick DuranoPosted May 2, 2015, 3:29 AM
Jithil JohnPosted May 2, 2015, 3:10 AM
Vincent Maverick DuranoPosted May 2, 2015, 2:40 AM
Santhakumar MunuswamyPosted May 2, 2015, 2:27 AM
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 DuranoPosted May 2, 2015, 2:21 AM
http://www.c-sharpcorner.com/Forums/Thread/295319/
The replies that i've posted should help you get started.