I have a grid as follows.
Course Fee Amount(dynamic textbox)
------ ----------
A1 15000
A2 5000
I have a textbox(outside the grid) txtTotalFeeAmount
with value say, 30000
. My requirement is that the Fee AMount of each A1 and A2 should be lesser than or equal to 30000. Also A1+A2
should be lesser than or equal to 30000. How do I do this?
EDIT
I tried the following, it doesn't work.
For Each gvRow As GridViewRow In gvCourseFeesDetails.Rows
Dim lblFeeHeadAmount As System.Web.UI.WebControls.Label = gvRow.FindControl("lblFeeHeadAmount")
'Dim lblTotalFeeAmount As System.Web.UI.WebControls.Label = gvRow.FindControl("lblTotalFeeAmount")
totalFeeHead = totalFeeHead + Val(lblFeeHeadAmount.Text)
Next
nIndividualFeeHead = Val(txtFeeHeadAmount.Text)
TotalAmount = totalFeeHead + Val(txtFeeHeadAmount.Text)
If TotalAmount > Val(txtFeeAmount.Text) Then
Dim script As String = String.Format("ValidateAmount()")
ScriptManager.RegisterClientScriptBlock(Me, GetType(Page), UniqueID, script, True)
Exit Sub
End If
My javascript function:
function ValidateAmount()
{
alert('Sum of Fee Head Amount should not exceed the total fee amount entered...!');
return false;
}