Newbie question - Use dropdownlist or textbox for db insert?

B

benjamin.derr

I have a webform that i'm using to insert a new entry into a database
table. For some of the columns, I'd like to give the user the option
of using a dropdownlist or a textbox, in order to allow the user to
use an existing entry, or to create a new entry value. However, when
the user posts/submits, the form is only using the value from textbox
entry, and not the dropdownlist. I do have the dropdownlist bound to
a select distinct query for that column. Not being very familiar with
coding here, I probablyI need to put some stuff in the code behind,
but am not sure exactly what I should be doing here. I'm using
ASP.Net 2 with vb.
 
T

Tom

get the selected item of the drop down

string strGetValue = DropDownList.SelectedItem.Text or if you want the value
string strGetValue = DropDownList.SelectedItem.value

and pass strGetValue to your insert/update SQL statement
 
B

benjamin.derr

Ok, now I have a better idea of what is going on. I have the two
controls in a formview template. I need to determine how to reference
the controls inside the formview in the code behind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top