views:

35

answers:

1

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  A: 

Use CausesValidation property of the Button or LinkButton controls to enable / disable validation for validation controls.

<asp:Button ID="btnGetRate" Text="Get Rate"
     CausesValidation="False" OnClick="btnGetRate_Click" runat="server"/>
Canavar
Thank you very much!
abatishchev