Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9054237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:38:20+00:00 2026-06-16T13:38:20+00:00

I bind two columns into a dropdown using SQL like this string query =

  • 0

I bind two columns into a dropdown using SQL like this

string query = "Select Id,Name+':'+Distribution_name+' 'as Name1 from BR_supervisor where( (id not in (select SupId from tbluser where active='true')) and active='true' ) ";

    DropDownList3.DataTextField = "Name1";
    DropDownList3.DataValueField = "Id";
    DropDownList3.DataBind();

Now I want to transform my query into linq expression and bind the dropdown. How to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:38:22+00:00Added an answer on June 16, 2026 at 1:38 pm
    var query = from s in db.BR_supervisor
                join u in db.tbluser.Where(x => x.active)
                     on s.id equals u.SupId into g
                where s.active && !g.Any()
                select new { 
                     s.Id, 
                     Name1 = s.Name + ":" + s.Distribution_name
                };
    
    DropDownList3.DataTextField = "Name1";
    DropDownList3.DataValueField = "Id";
    DropDownList3.DataSource = query;
    DropDownList3.DataBind();
    

    This generates SQL like:

    SELECT [t0].[Id], ([t0].[Name] + @p0) + [t0].[Distribution_name] AS [Name1]
    FROM [BR_supervisor] AS [t0]
    WHERE ([t0].[active] = 1) AND (NOT (EXISTS(
        SELECT NULL AS [EMPTY]
        FROM [tbluser] AS [t1]
        WHERE ([t0].[id] = [t1].[SupId]) AND ([t1].[active] = 1)
        )))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to bind data to two columns listbox like this: | Item1 | Item2
I'm trying to bind columns from two different tables in to gridview using Linq
Is there any way to bind two windows from seprate processes together using Python/Pygame?
I have a dropdown. I need to bind with two field of datatable value
If you bind a control in a FormView using two way binding (such as
I want to bind two lists to two columns of a Wpf DataGrid. How
Suppose in .aspx page their is dropdown in which i want to bind two
Hi I have a WebGrid with two columns: 1-Name 2-Action binded to another controller
I want to bind columns in a DataGridView to pull values from two different
I have a list of custom objects: say Fruits with two string properties Name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.