Solved

Populate DropDown with LINQ

Posted on 2010-11-29
5
473 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
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

Industry Leaders: 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!

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

688 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