When i am adding first row then if else condition is working but when i add second row then if else condition is not working
As per your refer Link
protected void txtamount_TextChanged(object sender, EventArgs e)
{
foreach (GridViewRow row in gvtrans.Rows)
{
TextBox bankid = row.FindControl("txtcode") as TextBox;
TextBox locid = row.FindControl("txtbank_id") as TextBox;
TextBox chqno = row.FindControl("txtChqno") as TextBox;
TextBox date = row.FindControl("txtdate") as TextBox;
TextBox amt = row.FindControl("txtamount") as TextBox;
if (bankid.Text == "")
{
Response.Write("<script>alert('Please Select Bank')</script>");
}
else if (locid.Text == "")
{
Response.Write("<script>alert('Please Select Location')</script>");
}
else if (chqno.Text == "")
{
Response.Write("<script>alert('Please Input Chequ No.')</script>");
}
else if (date.Text == "")
{
Response.Write("<script>alert('Please Select Cheque Date')</script>");
}
else if (amt.Text == "")
{
Response.Write("<script>alert('Please Input Amount')</script>");
}
else
{
addrow();
CalculateTotal();
}
}
}