Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / April 2005

Tip: Looking for answers? Try searching our database.

VB.NET databind to drop down list

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andy - 26 Apr 2005 15:21 GMT
I have a stored procedure in SQL Server that returns a list of names that I
would like to bind to a drop down list.  This is the code I have, but it is
not working correctly.  The drop down contains System.Data.DataRowView

Dim ConString As String = ConfigurationSettings.AppSettings("cs")
           Dim myCon As New SqlConnection(ConString)
       
           Dim CmdTextAssignedToListing As String = "usp_GetAssignedToNames"
           Dim CmdAssignedToListing As New
SqlDataAdapter(CmdTextAssignedToListing, myCon)
   
           Dim dsAssignedToListing As New DataSet
           'fill drop down with user names
           CmdAssignedToListing.Fill(dsAssignedToListing)
   
           'Databind to the Drop Down
           DropDownAssignedTo.DataSource = dsAssignedToListing
           DropDownAssignedTo.DataBind()

Any help is appreciated.
Cor Ligthert - 26 Apr 2005 16:00 GMT
Andy,

You miss the setting of the datatextfield in your dropdownlist
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwebuiwebcontrolslistcontrolclassdatatextfieldtopic.asp


It is now like a datagrid.

I hope this helps,

Cor

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.