Hi nauna,
Refer below sample.
HTML
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('[id*=TextBox1]').on('keyup', function () {
var txt1Total = 0;
$("[id*=TextBox1]").each(function () {
txt1Total += $(this).val() == '' ? 0 : parseFloat($(this).val());
});
$('[id*=Label2]').html(txt1Total);
if ($('[id*=Label2]').html() != $('[id*=Label3]').html()) {
$('[id*=Label4]').html("A and B Should Matched");
}
else {
$('[id*=Label4]').html("matched");
}
});
$('[id*=TextBox2]').on('keyup', function () {
var txt2Total = 0;
$("[id*=TextBox2]").each(function () {
txt2Total += $(this).val() == '' ? 0 : parseFloat($(this).val());
});
$('[id*=Label3]').html(txt2Total);
if ($('[id*=Label2]').html() != $('[id*=Label3]').html()) {
$('[id*=Label4]').html("A and B Should Matched");
}
else {
$('[id*=Label4]').html("matched");
}
});
});
</script>
<div>
<asp:ListView ID="ListView1" runat="server">
<ItemTemplate>
<div class="pickup">
Id :
<asp:Label ID="Label1" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
A:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
B:
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</div>
</ItemTemplate>
</asp:ListView>
<br />
A Total:
<asp:Label ID="Label2" runat="server"></asp:Label>
<br />
B Total:<asp:Label ID="Label3" runat="server"></asp:Label>
<asp:Label ID="Label4" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Save" />
</div>
Namespaces
C#
using System.Data;
VB.Net
Imports System.Data
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[] { new DataColumn("Id", typeof(int)) });
dt.Rows.Add(1);
dt.Rows.Add(2);
dt.Rows.Add(3);
dt.Rows.Add(4);
dt.Rows.Add(5);
this.ListView1.DataSource = dt;
this.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 DataTable = New DataTable()
dt.Columns.AddRange(New DataColumn() {New DataColumn("Id", GetType(Integer))})
dt.Rows.Add(1)
dt.Rows.Add(2)
dt.Rows.Add(3)
dt.Rows.Add(4)
dt.Rows.Add(5)
Me.ListView1.DataSource = dt
Me.ListView1.DataBind()
End If
End Sub
Screenshot