Newbie question - Use dropdownlist or textbox for db insert?

  • Thread starter Thread starter benjamin.derr
  • Start date Start date
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.
 
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
 
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.
 
Back
Top