Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Newbie question - Use dropdownlist or textbox for db insert?

Reply
Thread Tools

Newbie question - Use dropdownlist or textbox for db insert?

 
 
benjamin.derr@css-security.com
Guest
Posts: n/a
 
      05-29-2007
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.

 
Reply With Quote
 
 
 
 
Tom
Guest
Posts: n/a
 
      05-29-2007
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




<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
>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.
>



 
Reply With Quote
 
 
 
 
Jon Paal [MSMD]
Guest
Posts: n/a
 
      05-29-2007
You can learn about dropdownlists here:

http://msconline.maconstate.edu/tuto...20/default.htm

See:

6. Input and Selection Controls


<(E-Mail Removed)> wrote in message news:(E-Mail Removed) ups.com...
>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.
>



 
Reply With Quote
 
benjamin.derr@css-security.com
Guest
Posts: n/a
 
      05-29-2007
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.


 
Reply With Quote
 
Jon Paal [MSMD]
Guest
Posts: n/a
 
      05-30-2007
I believe you will want to use the findcontrol method

http://msconline.maconstate.edu/tuto...pnet09-03.aspx



<(E-Mail Removed)> wrote in message news:(E-Mail Removed) ups.com...
> 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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use textbox to filter a DropDownList Rob ASP .Net Web Controls 2 03-20-2007 03:46 PM
Use dropdownlist as textbox Li Pang ASP .Net Web Controls 3 08-10-2006 05:22 PM
runat="server"....a simple html textbox or a webform server textbox...that is the question. Hazzard ASP .Net 2 07-23-2003 07:32 AM
Re: runat="server"....a simple html textbox or a webform server textbox...that is the question. Natty Gur ASP .Net 0 07-22-2003 03:57 AM
Re: VERY STRANGE BUG? Adding a textbox control causes other textbox control to fail??? S. Justin Gengo ASP .Net 0 07-16-2003 06:51 PM



Advertisments