如何根据另外两个具有数值的文本框来验证文本框(总计)

How to validate a text box (total) based on two other textboxes with numeric values

我正在使用 Telerik RadGrid,在网格中有多个 radtextbox,例如 A、B、C 和 D。我使用带有正则表达式验证的 radtextbox 来验证带有数字的 A、B 和 C 文本框。但是,文本框 D 是 A+B+C。我的问题是如果使用 customvalidator,我如何在网格中验证它,以提醒用户总数不准确?

这是我为 radD 想出的一段代码:

> <telerik:RadTextbox ID="radD" runat="server" Autopostback="true"
> Type="Number" text=<%# Bind("TotalD") </telerik:Radtextbox>
> 
> <asp:customvalidator ID =CV1 controltovalidate=radD
> errormessage="Inaccuratetotal"
> clientvalidationfunction="total_validate"/>

我的问题是:如何根据 A、B 和 C 为文本框 D 编写客户端验证函数代码。谁能指出正确的方向?

提前致谢。

笨蛋

你没有包含total_validate函数中的内容,所以我会为你写一些伪代码。

function total_validate(sender, args){
    var control = $find(sender.controltovalidate);
    var textBoxA = $find(//textBoxA ID).value;
    var textBoxB = $find(//textBoxB ID).value;
    var textBoxC = $find(//textBoxC ID).value;


    if (//textbox a plus b plus c is NOT what you want) 
    {
        arguments.IsValid = false;
    }

}