Hi ramco1917,
Please refer below sample.
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" />
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script>
<asp:Repeater ID="rptDetails" runat="server">
<ItemTemplate>
<div class="card card_content">
<ul class="list-group list-group-flush">
<li class="list-group-item">
<div class="user_tag"><%#Eval("CustomerID") %></div>
<div class="delivery-details">
<h5><%#Eval("Name") %></h5>
<p><%#Eval("Country") %></p>
</div>
</li>
</ul>
</div>
</ItemTemplate>
</asp:Repeater>
Namespace
C#
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
VB.Net
Imports System.Data
Imports System.Configuration
Imports System.Data.SqlClient
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if(!this.IsPostBack)
{
this.BindRepeater();
}
}
private void BindRepeater()
{
string conString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using(SqlConnection con = new SqlConnection(conString))
{
using(SqlCommand cmd = new SqlCommand("SELECT CustomerId, Name, Country FROM Customers",con))
{
using(SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
DataTable dt = new DataTable();
sda.Fill(dt);
rptDetails.DataSource = dt;
rptDetails.DataBind();
}
}
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Me.BindRepeater()
End If
End Sub
Private Sub BindRepeater()
Dim conString As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
Using con As SqlConnection = New SqlConnection(conString)
Using cmd As SqlCommand = New SqlCommand("SELECT CustomerId, Name, Country FROM Customers", con)
Using sda As SqlDataAdapter = New SqlDataAdapter(cmd)
Dim dt As DataTable = New DataTable()
sda.Fill(dt)
rptDetails.DataSource = dt
rptDetails.DataBind()
End Using
End Using
End Using
End Sub
Screenshot