0

I have a UserControl used for getting an exchange rate amount from user (bank manager) he prefer to be used by an account operation. Exchange rate can be loaded from central bank web service but just as a tip - final value is chosen by user.

It contains one asp:TextBox box and two asp:LinkButton - Get (exchange rate) and Approve (client request).

The text box value must be checked for existence (by RequiredFieldValidator) and correctness (by RegularExpressionValidator and CompareValidator) before approving.

So the problem is - if user clicks on Get button, validation also is invoked and failed. How to disable it for Get button but enable for Approve button?

4

1 回答 1

6

使用Button 或 LinkBut​​ton 控件的CausesValidation属性来启用/禁用验证控件的验证。

<asp:Button ID="btnGetRate" Text="Get Rate"
     CausesValidation="False" OnClick="btnGetRate_Click" runat="server"/>
于 2009-11-26T21:15:34.013 回答