Hi indradeo,
Use Repeater control.
Refer below sample code.
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
* { box-sizing: border-box; }
body { font-family: Verdana, sans-serif; }
img { vertical-align: middle; }
/* Slideshow container */
.slideshow-container { max-width: 1000px; position: relative; margin: auto; text-align: center; }
.active { background-color: #717171; }
/* Fading animation */
.fade { animation-name: fade; animation-duration: 1.5s; }
@keyframes fade {
from { opacity: .4 }
to { opacity: 1 }
}
</style>
<script>
var slideIndex = 0;
window.onload = function () {
var slides = document.getElementsByClassName('mySlides');
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
slides[slideIndex].style.display = "block";
slideIndex++;
if (slideIndex <= slides.length) {
setInterval(function () {
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
slides[slideIndex].style.display = "block";
slideIndex++;
if (slideIndex == slides.length) {
slideIndex = 0;
}
}, 2000);
}
};
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="slideshow-container">
<asp:Repeater ID="rptSilders" runat="server">
<ItemTemplate>
<div class="mySlides fade">
<asp:Image ID="Image1" ImageUrl='<%#Eval("PhotoPath") %>' runat="server" hight='30' Width="200" />
<br />
<b>Vehicle Reg. No.:</b>
<asp:Label ID="Label7" Text='<%# Eval("Vhclrgn") %>' runat="server" />
<br />
<b>Speed (km/h):</b>
<asp:Label ID="Label3" Text='<%#Eval("spd") %>' runat="server" />
<br />
<b>Violation Date:</b>
<asp:Label ID="Label5" Text='<%# Eval("vltrsdt","{0:dd/MM/yyyy}") %>' runat="server" />
<br />
<b>Camera Location:</b>
<asp:Label ID="Label6" Text='<%# Eval("lcn") %>' runat="server" />
<br />
<b>Dept./Agency:</b>
<asp:Label ID="Label4" Text='<%# Eval("dptangcy") %>' runat="server" />
<br />
<b>Violator:</b>
<asp:Label ID="Label1" Text='<%# Eval("nm") %>' runat="server" />
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.BindListView();
}
}
private void BindListView()
{
System.Data.DataTable dt = new System.Data.DataTable();
dt.Columns.Add("EID");
dt.Columns.Add("nm");
dt.Columns.Add("Vhclrgn");
dt.Columns.Add("spd");
dt.Columns.Add("dptangcy");
dt.Columns.Add("vltrsdt", typeof(DateTime));
dt.Columns.Add("lcn");
dt.Columns.Add("PhotoPath");
dt.Rows.Add("1", "Name 1", "123", "100", "200", "2024-06-06", "1", "~/Images/Desert.jpg");
dt.Rows.Add("2", "Name 2", "123", "100", "200", "2024-06-06", "1", "~/Images/Hydrangeas.jpg");
dt.Rows.Add("3", "Name 3", "123", "100", "200", "2024-06-06", "1", "~/Images/Jellyfish.jpg");
rptSilders.DataSource = dt;
rptSilders.DataBind();
}
Screenshot