更新时间:2023-02-20 15:47:00
选项1:
在Grid内这样的事情怎么样:
OPTION 1:
How about something like this inside the Grid:
<EditItemTemplate>
<asp:TextBox id="txtReceived"></asp:TextBox>
<asp:customvalidator id="cvalReceived" runat="server" ClientValidationFunction="ValidateReceivedAmounts" ControlToValidate="txtReceived">
</asp:customvalidator>
</EditItemTemplate>
选项2:
使用Javascript验证.使用属性将Javascript方法添加到客户端onKeyDown.现在,在JavaScript中,检查输入的值,如果不是整数则显示错误,或者只是取消按下的键.
OPTION 2:
Use Javascript validation. Add a Javascript method to the client side onKeyDown using attributes. Now, in JavaScript, check the value entered and show error if not integer or just cancel out the key pressed.