?
Solved

Populate DropDown with LINQ

Posted on 2010-11-29
5
Medium Priority
?
477 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 500 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

Technology Partners: 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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

741 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