Hi nauna,
Refer below sample.
HTML
<asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="CustomerId" HeaderText="CustomerId" />
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Country" HeaderText="Country" />
</Columns>
</asp:GridView>
Namespaces
C#
using TestModel;
VB.Net
Imports TestModel
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
TestEntities test = new TestEntities();
var result = from res in test.Customers
where new[] { 1, 2 }.Contains(res.CustomerId)
select res;
gvCustomers.DataSource = result;
gvCustomers.DataBind();
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim test As TestEntities = New TestEntities()
Dim result = From res In test.Customers Where {1, 2}.Contains(res.CustomerId) Select res
gvCustomers.DataSource = result
gvCustomers.DataBind()
End If
End Sub
Screenshot