By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,917 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,917 IT Pros & Developers. It's quick & easy.

Strange Behavior from RequiredFieldValidator (and Two LinkButtons)

P: n/a
JJ
We have an ASP.NET web form with 1 TextBox, 2 LinkButtons, and 1
RequireFieldValidator. The situation is: the user needs to enter a folder
name in the TextBox and click the first LinkButton (the Create Folder
LinkButton) to create the folder. Then once that's done, they need to click
the second LinkButton (the Next LinkButton) to go to the next page (a
rudimentary wizard).

The RequiredFieldValidator is there to make sure the user enters a folder
name in the TextBox before clicking the first LinkButton (the Create Folder
LinkButton). This all works fine.

What's strange is if the user doesn't enter anything in the TextBox and
clicks the second LinkButton (the Next LinkButton) before clicking the first
LinkButton (the Create Folder LinkButton), the RequiredFieldValidator alarms
the error anyway.

Is this correct behavior? What we want is for the first LinkButton (the
Create Report LinkButton) only to validate that text has been entered in the
TextBox, not the second LinkButton (the Next LinkButton). How can we do
this?
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi JJ,

The function of the requiredfield validator is just to check the txtbox is
having some value or not.

If you want that checking has to be made only for the first link button and
not for the second link button, then specifically you have to inform the
validator as follows.

1. Click the second link button and go to the properties window.

2. Set the cause validation property to False.

So, here after when you are click second link button form will not do any
validations.

Hope this helps you.

Cheers,

Jerome. M
"JJ" wrote:
We have an ASP.NET web form with 1 TextBox, 2 LinkButtons, and 1
RequireFieldValidator. The situation is: the user needs to enter a folder
name in the TextBox and click the first LinkButton (the Create Folder
LinkButton) to create the folder. Then once that's done, they need to click
the second LinkButton (the Next LinkButton) to go to the next page (a
rudimentary wizard).

The RequiredFieldValidator is there to make sure the user enters a folder
name in the TextBox before clicking the first LinkButton (the Create Folder
LinkButton). This all works fine.

What's strange is if the user doesn't enter anything in the TextBox and
clicks the second LinkButton (the Next LinkButton) before clicking the first
LinkButton (the Create Folder LinkButton), the RequiredFieldValidator alarms
the error anyway.

Is this correct behavior? What we want is for the first LinkButton (the
Create Report LinkButton) only to validate that text has been entered in the
TextBox, not the second LinkButton (the Next LinkButton). How can we do
this?

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.