borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (hwnd of my program)Next Topic (Encryption With Password) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : no item selected in dropdown list
Poster Message
Anita
Level: Big Cheese

Registered: 19-05-2005
Posts: 24

icon no item selected in dropdown list

I have a dropdown list in a datagrid column.  The data to populate the list comes from a table.  When the user clicks "add" to add a new row, I want no entries in the dropdown list initially selected.  If the user saves without selecting from the dropdown list, I want "none" saved instead of what is happening now --- the first entry is saved.  

Thanks for any help!

[Edited by Anita on 06-03-2006 at 06:49 PM GMT]

06-03-2006 at 06:48 PM
View Profile Send Email to User Show All Posts | Quote Reply
xtramac
Level: Professor


Registered: 28-08-2005
Posts: 89
icon Re: no item selected in dropdown list

helloo..

i know this is an ingenius solution...   ..

maybe you can try this.. before you populate your list with data from your db put "none" first and after that put all the data you get from your db..


    


andrew

09-03-2006 at 05:51 AM
View Profile Send Email to User Show All Posts | Quote Reply
~Bean~
Level: VB Guru


Registered: 07-04-2003
Posts: 488
icon Re: no item selected in dropdown list

If you are binding the Drop Down, you probably want to add the extra item AFTER you bind. Setting its index to 0 (zero) should make it first in the list, and, by default, selected.

something like...

'do your binding here...
DropDown1.DataBind
'then...
Dim theItem As New ListItem
theItem.Value = "none"
theItem.Text = ""
DropDown1.Items.Insert(0, theItem)




____________________________
Eggheads unite! You have nothing to lose but your yolks.

13-03-2006 at 06:51 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Anita
Level: Big Cheese

Registered: 19-05-2005
Posts: 24
icon Re: no item selected in dropdown list

Thank you for your help.  Adding the item AFTER binding was the answer I needed.  

15-03-2006 at 03:19 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB.Net : no item selected in dropdown list
Previous Topic (hwnd of my program)Next Topic (Encryption With Password) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder