Hi nauna,
Check this example. Now please take its reference and correct your code.
HTML
<asp:ListView ID="ListView1" runat="server">
<ItemTemplate>
<div class="col-md-3 padding15">
<div class="camp">
<div class="img-div">
<asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("Image") %>' />
</div>
<div class="padding15">
<h5 class="no-margin upp">
<%#Eval("PackageName") %>
</h5>
<p class="h-50 small">
<%#Eval("description") %>
</p>
<p class=" large l-bold line30">
<small class="grey-c small">Donation Amount </small>
<br />
<span class="btn w-100 radius theme-bg no-padding" style="height: 3px;"></span>
<strong>
<asp:Label ID="Label1" runat="server" Text='<%#Eval("received") %>'></asp:Label>
raised </strong>
<asp:Label ID="Label2" runat="server" Text='<%#Eval("donationamount") %>'></asp:Label>
<a class="pull-right btn theme-bg white-c medium m-bold margintb-15" href="detail?ID=<%#Eval("donationmasterguid") %>">Donate Now</a>
</p>
<p>
<asp:HiddenField ID="hfPercentage" runat="server" Value='<%#Eval("Percentage") %>' />
<div class="progress progress-striped">
<div class="progress-bar progress-bar-success">
</div>
</div>
</p>
</div>
</div>
</div>
</ItemTemplate>
</asp:ListView>
<style type="text/css">
.bar-success {
background-color: #5cb85c;
}
.bar-info {
background-color: #5bc0de;
}
.bar-warning {
background-color: #f0ad4e;
}
.bar-danger {
background-color: #d9534f;
}
</style>
<link type="text/css" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" />
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(function () {
$('.progress').each(function () {
var percent = $(this).parent().find('[id*=hfPercentage]').val();
$(this).addClass('progress-striped').addClass('active');
$(this).find('.progress-bar:first').removeClass()
.addClass('progress-bar')
.addClass((percent < 40) ? 'progress-bar-danger' : ((percent < 80) ? 'progress-bar-warning' : 'progress-bar-success'));
$(this).find('.progress-bar:first').width(percent + '%');
$(this).find('.progress-bar:first').text(percent + '%');
});
});
</script>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
System.Data.DataTable dt = new System.Data.DataTable();
dt.Columns.Add("Image");
dt.Columns.Add("PackageName");
dt.Columns.Add("description");
dt.Columns.Add("received");
dt.Columns.Add("donationamount");
dt.Columns.Add("donationmasterguid");
dt.Columns.Add("Percentage");
dt.Rows.Add("", "Package 1", "Covid-19", "500", "1000", "1", "50");
dt.Rows.Add("", "Package 2", "Covid-19", "800", "1000", "2", "80");
dt.Rows.Add("", "Package 3", "Covid-19", "250", "1000", "3", "25");
ListView1.DataSource = dt;
ListView1.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("Image")
dt.Columns.Add("PackageName")
dt.Columns.Add("description")
dt.Columns.Add("received")
dt.Columns.Add("donationamount")
dt.Columns.Add("donationmasterguid")
dt.Columns.Add("Percentage")
dt.Rows.Add("", "Package 1", "Covid-19", "500", "1000", "1", "50")
dt.Rows.Add("", "Package 2", "Covid-19", "800", "1000", "2", "80")
dt.Rows.Add("", "Package 3", "Covid-19", "250", "1000", "3", "25")
ListView1.DataSource = dt
ListView1.DataBind()
End If
End Sub
Screenshot