Hi AliYilmaz,
You need to make use of GroupJoin with SelectMany in Lambda Expression.
Refer below example.
Database
I have made use of two tables namely VehicleTypes and VehicleSubTypes. The schema and the data present in both the tables are as follows.
VehicleTypes
![](https://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=0e09f47d-fe09-4873-bed2-a0107798ac00.png)
![](https://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=93bc7c09-da46-4b38-a9d0-eb58659332e2.png)
VehicleSubTypes
![](https://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=1f39eb3c-e78c-44c2-8977-b75b4974f875.png)
![](https://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=21e049e4-fad2-4a22-8a7d-57b201fa78fe.png)
You can download the database table SQL by clicking the download link below.
Download SQL File
HTML
<asp:GridView runat="server" ID="gvVehicles" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" />
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Type" HeaderText="Type" />
</Columns>
</asp:GridView>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
using (VehiclesDBEntities entities = new VehiclesDBEntities())
{
List<Vehicle> vehicles = entities.VehicleSubTypes
.GroupJoin(entities.VehicleTypes, vs => vs.VehicleTypeId, v => v.Id, (vs, v) => new { vs, v })
.SelectMany(vs => vs.v.DefaultIfEmpty(), (x, y) =>
new Vehicle
{
Id = x.vs.Id,
Name = x.vs.Name,
Type = y.Name
}).ToList();
gvVehicles.DataSource = vehicles;
gvVehicles.DataBind();
}
}
}
public class Vehicle
{
public int Id { get; set; }
public string Name { get; set; }
public string Type { get; set; }
}
Screenshot
![](https://i.imgur.com/osgupjt.png)