Solved

Populate DropDown with LINQ

Posted on 2010-11-29
5
471 Views
Last Modified: 2012-05-10
Just starting to work with LINQ.  I want to populate a dropdown from a table that contains two fields: Role and Role_ID_pk.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        ' Populate the Ticket Master Role DropDown
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        Using myDataContext As New TicketStoreDataContext()
            Dim AllTicketMasterRoles = From Ticket_Master_Role In myDataContext.TICKET_MASTER_ROLEs _
                                       Select Ticket_Master_Role.Role, Ticket_Master_Role.Role_ID_pk

            Dim ddTicketMasterRoles As New DropDownList
            ddTicketMasterRoles = CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddTicketMasterRoles")
            ddTicketMasterRoles.DataSource = AllTicketMasterRoles
            ddTicketMasterRoles.DataTextField = ?????????
            ddTicketMasterRoles.DataValueField = ????????
            ddTicketMasterRoles.DataBind()

        End Using

Open in new window

0
Comment
Question by:rrhandle8
  • 2
  • 2
5 Comments
 
LVL 29

Expert Comment

by:Kumaraswamy R
ID: 34236503
0
 
LVL 29

Accepted Solution

by:
Kumaraswamy R earned 125 total points
ID: 34236511
0
 

Author Comment

by:rrhandle8
ID: 34236524
Already read all three.  No help.
0
 
LVL 2

Expert Comment

by:getnitincr
ID: 34236526
0
 

Author Comment

by:rrhandle8
ID: 34236539
Oops!  I did not read the last one: http://social.msdn.microsoft.com/forums/en-US/linqprojectgeneral/thread/f52f7a08-6a9e-4cd8-81e6-6f5dc3104169/ 
Just added the field names.

            ddTicketMasterRoles.DataTextField = "Role"
            ddTicketMasterRoles.DataValueField = "Role_ID_pk"
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question