Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > DropDownList - Is it Possible to get the TextField Contents

Reply
Thread Tools

DropDownList - Is it Possible to get the TextField Contents

 
 
page77.office@googlemail.com
Guest
Posts: n/a
 
      05-30-2006
Is it possible to get at the textfield of a SelectedValue in a drop
down list box ?

If not I can think of two possible solutions

1) Requery the database

2) copy the dropdownlist to an arraylist in memory and get the text
value from the list

Any help appreciated

 
Reply With Quote
 
 
 
 
mnichols
Guest
Posts: n/a
 
      05-30-2006
try:

http://msdn.microsoft.com/library/de...trolsample.asp

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Is it possible to get at the textfield of a SelectedValue in a drop
> down list box ?
>
> If not I can think of two possible solutions
>
> 1) Requery the database
>
> 2) copy the dropdownlist to an arraylist in memory and get the text
> value from the list
>
> Any help appreciated
>

 
Reply With Quote
 
 
 
 
CaffieneRush@gmail.com
Guest
Posts: n/a
 
      05-30-2006
We're a bit puzzled because it seems like you answered your own
question - the SelectedValue of the DropDownList will give you the
value of the selected listitem within the ddl.

If you want the actual control itself then SelectedItem property is
what you want.
Eg..
Dim textbox1 As Textbox = CType(DropDownList1.SelectedItem, TextBox)
Dim textValue As String = textbox1.Text

If you are not getting the value you expect back then you're probably
accessing the value is the incorrect phase of the lifecycle or have
overwritten your values or something else I haven't thought about.

Regards,
Andy

 
Reply With Quote
 
Colin McKenney
Guest
Posts: n/a
 
      06-15-2006
Try this:

Dim selItemText As New ListItem
selItemText = DropDownList.Items(DropDownList.SelectedIndex)
Label.Text = selItemText.Text

Hope that helps

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> Is it possible to get at the textfield of a SelectedValue in a drop
> down list box ?
>
> If not I can think of two possible solutions
>
> 1) Requery the database
>
> 2) copy the dropdownlist to an arraylist in memory and get the text
> value from the list
>
> Any help appreciated
>



 
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
How to get or set the text of a textfield? Anthony Papillion Python 5 07-11-2011 02:24 PM
Adding contents on yaml file without overwriting actual contents Kamarulnizam Rahim Ruby 4 01-28-2011 09:10 AM
DropDownList - Is it Possible to get at the TextField Contents mosscliffe ASP .Net 7 05-31-2006 05:49 AM
get and put value from a dynamicly created textfield Pål Sindre Hiåsen Javascript 3 05-27-2005 07:26 PM
Can I restrict both attribute contents and element contents in schema Don Adams XML 1 03-05-2004 12:48 PM



Advertisments