Hi Mehram,
Refer below sample.
HTML
<asp:DataList ID="dlMembers" runat="server" RepeatDirection="Horizontal" RepeatLayout="Table" RepeatColumns="2" BackColor="Window">
<ItemTemplate>
<div>
<div style="float: left;">
<asp:Image ID="lblImage" runat="server" Width="50" Height="50" ImageUrl='<%#Eval("Image")%>' Style="border-radius: 50%;" />
</div>
<div style="float: left; padding-left: 10px; width:150px;">
<div>
<asp:Label ID="lblId" runat="server" Text='<%#Eval("Id")%>' Font-Bold="true"></asp:Label>
<hr />
</div>
<div>
<asp:Label ID="lblName" runat="server" Text='<%#Eval("Name")%>' Font-Bold="true"></asp:Label>
<hr />
</div>
</div>
</div>
</ItemTemplate>
</asp:DataList>
Namespaces
C#
using System.Data;
VB.Net
Imports System.Data
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.BindDataList();
}
}
private void BindDataList()
{
using (DataTable dt = new DataTable())
{
dt.Columns.AddRange(new DataColumn[3] {
new DataColumn("Id"),
new DataColumn("Name"),
new DataColumn("Image") });
dt.Rows.Add(1, "Koala", "Images/Koala.jpg");
dt.Rows.Add(2, "Jellyfish", "Images/Jellyfish.jpg");
dt.Rows.Add(3, "Desert", "Images/Desert.jpg");
dt.Rows.Add(4, "Penguins", "Images/Penguins.jpg");
dlMembers.DataSource = dt;
dlMembers.DataBind();
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Me.BindDataList()
End If
End Sub
Private Sub BindDataList()
Using dt As DataTable = New DataTable()
dt.Columns.AddRange(New DataColumn(2) {
New DataColumn("Id"),
New DataColumn("Name"),
New DataColumn("Image")})
dt.Rows.Add(1, "Koala", "Images/Koala.jpg")
dt.Rows.Add(2, "Jellyfish", "Images/Jellyfish.jpg")
dt.Rows.Add(3, "Desert", "Images/Desert.jpg")
dt.Rows.Add(4, "Penguins", "Images/Penguins.jpg")
dlMembers.DataSource = dt
dlMembers.DataBind()
End Using
End Sub
Screenshot