0
[textbox1] [textbox2] [button1] [linkbutton1] 

i have 2 textboxes, 2 RequiredFieldValidator, button1 and linkbutton. the button1 and 2textboxes are working properly with RequiredFieldValidator, but if i click the linkbutton the RequiredFieldValidator also appears.

I want the RequiredFieldValidator focus only in button1. Is this possible?

3 Answers 3

3

Set CausesValidation="false" in your link button markup like this

<asp:LinkButton ID="lnkButton" runat="server" CausesValidation="false"></asp:LinkButton> 
Sign up to request clarification or add additional context in comments.

Comments

0

you need to specify Validation Groups

 <asp:requiredfieldvalidator id="RequiredFieldValidator2" controltovalidate="AgeTextBox" validationgroup="PersonalInfoGroup" errormessage="Enter your age." runat="Server"> </asp:requiredfieldvalidator> 

Comments

0

Use ValidationGroup property of RequiredFieldValidator.

Set the ValidataionGroup="someName" for your textbox1-requiredfieldvalidator, textbox2- requiredfieldvalidator and your button1 control.

Note: Keep the name of the ValidationGroup same.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.