• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 485
  • Last Modified:

Populate DropDown with LINQ

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
rrhandle8
Asked:
rrhandle8
  • 2
  • 2
1 Solution
 
rrhandle8Author Commented:
Already read all three.  No help.
0
 
getnitincrCommented:
0
 
rrhandle8Author Commented:
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now