我有一个网格如下。
Course Fee Amount(dynamic textbox)
------ ----------
A1 15000
A2 5000
我有一个文本框(网格外)txtTotalFeeAmount
,其值为30000
。我的要求是每个A1和A2的费用金额应小于或等于30000.另外A1+A2
应小于或等于30000.我该怎么做?
修改
我尝试了以下操作,但它不起作用。
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
我的javascript函数:
function ValidateAmount()
{
alert('Sum of Fee Head Amount should not exceed the total fee amount entered...!');
return false;
}