Hi tanweeruddinb...,
Refer below sample.
HTML
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtoolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.Star {
background-image: url(images/Star.gif);
height: 17px;
width: 17px;
}
.WaitingStar {
background-image: url(images/WaitingStar.gif);
height: 17px;
width: 17px;
}
.FilledStar {
background-image: url(images/FilledStar.gif);
height: 17px;
width: 17px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<ajaxtoolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</ajaxtoolkit:ToolkitScriptManager>
<asp:Repeater ID="RP_teacher" runat="server">
<HeaderTemplate>
<table>
<tr>
<th>Image</th>
<th>Name</th>
<th>Rating</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<div class="thumb">
<img src='<%#"teacher/"+Eval("tch_image")%>' class="img-fullwidth" onerror="this.src='<%=Page.ResolveClientUrl("teacher/images/default.png") %>'" />
</div>
</td>
<td>
<h3 class="name text-white mt-0"><%#Eval("tname")%></h3>
</td>
<td>
<asp:Panel ID="Panel1" runat="server" Enabled="false" ClientIDMode="Static">
<ajaxtoolkit:Rating ID="Rating2" runat="server" CurrentRating='<%# Eval("avgrate") %>'
StarCssClass="Star" WaitingStarCssClass="WaitingStar" EmptyStarCssClass="Star"
FilledStarCssClass="FilledStar">
</ajaxtoolkit:Rating>
</asp:Panel>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
</body>
</html>
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
System.Data.DataTable dt = new System.Data.DataTable();
dt.Columns.Add("tch_image");
dt.Columns.Add("tname");
dt.Columns.Add("avgrate", typeof(int));
dt.Rows.Add("", "tanveer beeharry", 0);
dt.Rows.Add("", "xxx yyy", 4);
dt.Rows.Add("", "fer eeredger", 0);
RP_teacher.DataSource = dt;
RP_teacher.DataBind();
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim dt As System.Data.DataTable = New System.Data.DataTable()
dt.Columns.Add("tch_image")
dt.Columns.Add("tname")
dt.Columns.Add("avgrate", GetType(Integer))
dt.Rows.Add("", "tanveer beeharry", 0)
dt.Rows.Add("", "xxx yyy", 4)
dt.Rows.Add("", "fer eeredger", 0)
RP_teacher.DataSource = dt
RP_teacher.DataBind()
End If
End Sub