Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to populate unrelated two data tables in one dropdowlist?
Posted

Use Union
Select <column name=""> as 'DisplayText',<column name=""> as ' ValueText' from Table2

Union

Select <column name=""> as 'DisplayText',<column name=""> as ' ValueText' from Table2

Attach this as datasource to Drop down.
 
Share this answer
 
v2
You can add data from both the tables in list.

Step 1:

get Data from both the SQL tables.


step 2:

Add data in a list from table 1 and then table 2 using for each loop or using linq

step 3:

Pass this list to View layer
 
Share this answer
 
v2
Make one manual Dataset,
add data of two dadatables in dataset using for loop.
Then set dropdowlist's properties like DataSource,DisplayMember and ValueMember
etc.You will get contents of both datatables in combobox.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900