开发者

Is it possible to avoid control validation after clicking one button and don't after clicking another?

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.

S开发者_StackOverflowo 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?


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"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜