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

Going crazy with requiredfieldvalidator controls . Kindly help me

P: n/a
Hello friends...
On a single asp.net web page i have a single server-side form that contains
a couple of user-controls. Each user control has its own functionality and
contains server-side textbox controls, requiredfieldvalidator controls which
validate the textboxes, and a linkbutton control that postbacks the web
page. The problem is, when the user clicks on the linkbutton control on one
user control, the requiredfieldvalidator gets executed for all the user
controls that are present on the page. We only need the
requiredfieldvalidator controls to get executed for the user-control on
which the user clicked the linkbuttons. How can we do this. I have actually
asked this question 3 months back on this newsgroup, and no one actually
answered. I am still struggling to find out how this can be done. Please
help.

Thanks alot

Navin
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Navin,

The controls on a page that trigger a post back to the server (like your
button and link controls) trigger client side and server side page
validation to occurr for the entire page their behaviour is designed this
way.

First for any control that should post back to the server that shouldn't
trigger a page validation of any sort I would set it's "CausesValidation"
property to false.

The other controls are going to be difficult if not impossible to use the
way you want with client side validation. You may have to resort to setting
all the button and links on your page to not cause validation and just do
your required field validation on post back. You would do this by calling
the required field validator's "Validate" method server side.

If you need client side validation you may need to write your own javascript
to do so.

I know this isn't what you were hoping to hear, but the validation objects
just weren't created to be split up like that. They work on a form wide
basis and the entire page is one single form...

Sorry,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Navin" <nv@nv.com> wrote in message
news:eG*************@TK2MSFTNGP12.phx.gbl...
Hello friends...
On a single asp.net web page i have a single server-side form that contains a couple of user-controls. Each user control has its own functionality and
contains server-side textbox controls, requiredfieldvalidator controls which validate the textboxes, and a linkbutton control that postbacks the web
page. The problem is, when the user clicks on the linkbutton control on one user control, the requiredfieldvalidator gets executed for all the user
controls that are present on the page. We only need the
requiredfieldvalidator controls to get executed for the user-control on
which the user clicked the linkbuttons. How can we do this. I have actually asked this question 3 months back on this newsgroup, and no one actually
answered. I am still struggling to find out how this can be done. Please
help.

Thanks alot

Navin

Nov 17 '05 #2

P: n/a
Navin,

I thought of one other possibility.

If a required field validator's "Enabled" property is set to "False" then,
of course, it doesn't stop the page from being posted. Even if the object it
validates doesn't have a value.

I just checked and the validator is still rendered on the page even if it is
not enabled.

You should be able to enable or disable the validators client side depending
on which button holds focus.

This should let you do exactly what you want.

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Navin" <nv@nv.com> wrote in message
news:eG*************@TK2MSFTNGP12.phx.gbl...
Hello friends...
On a single asp.net web page i have a single server-side form that contains a couple of user-controls. Each user control has its own functionality and
contains server-side textbox controls, requiredfieldvalidator controls which validate the textboxes, and a linkbutton control that postbacks the web
page. The problem is, when the user clicks on the linkbutton control on one user control, the requiredfieldvalidator gets executed for all the user
controls that are present on the page. We only need the
requiredfieldvalidator controls to get executed for the user-control on
which the user clicked the linkbuttons. How can we do this. I have actually asked this question 3 months back on this newsgroup, and no one actually
answered. I am still struggling to find out how this can be done. Please
help.

Thanks alot

Navin

Nov 17 '05 #3

P: n/a
Yes Justin... this last idea that u gave me sounds a little good and I am
testing things out with it.
Thanks for your idea.

"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Navin,

I thought of one other possibility.

If a required field validator's "Enabled" property is set to "False" then,
of course, it doesn't stop the page from being posted. Even if the object it validates doesn't have a value.

I just checked and the validator is still rendered on the page even if it is not enabled.

You should be able to enable or disable the validators client side depending on which button holds focus.

This should let you do exactly what you want.

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Navin" <nv@nv.com> wrote in message
news:eG*************@TK2MSFTNGP12.phx.gbl...
Hello friends...
On a single asp.net web page i have a single server-side form that

contains
a couple of user-controls. Each user control has its own functionality and contains server-side textbox controls, requiredfieldvalidator controls

which
validate the textboxes, and a linkbutton control that postbacks the web
page. The problem is, when the user clicks on the linkbutton control on

one
user control, the requiredfieldvalidator gets executed for all the user
controls that are present on the page. We only need the
requiredfieldvalidator controls to get executed for the user-control on
which the user clicked the linkbuttons. How can we do this. I have

actually
asked this question 3 months back on this newsgroup, and no one actually
answered. I am still struggling to find out how this can be done. Please
help.

Thanks alot

Navin


Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.