How can I insert two different values into columns of a table in a database when both values come from the same DropDownList? For example one value is ‘name’ and the other is ‘id’.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If I understand your situation.
the ‘name’ value is the
DataTextFieldin thedropDown,and the ‘id’ value is the
DataValueFieldin the dropDown.so,
If it’s realy like that, it simple to do it, you have to take the:
DropDownList1.Items[ DropDownList1.SelectedIndex].Text– this is the ‘name’ value, and the:DropDownList1.SelectedValue– this is the ‘id’ value.