473,396 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Going crazy with requiredfieldvalidator controls . Kindly help me

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
3 5241
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: BK | last post by:
I'm having a really strange problem with and HtmlSelect server control (listbox) and a RequiredFieldValidator that I am trying to use to make sure that someone has items in the listbox. The way...
1
by: ad | last post by:
I want to combine a TextBox and a RequiredFieldValidator into to a web custom control (name RequireTextBox ), But when I use RequireTextBox in web form, the RequiredFieldValidator has no action....
7
by: Ed West | last post by:
Hello, I have a simple form with some input boxes. After validation if one fails, then I would like to at the top of the page say something like "The following fields in red are required" and...
4
by: James | last post by:
Hello, I have a RequiredFieldValidator for several textbox controls on a form. Here's an example with the RequiredFieldValidator. EnableClientScript, Enabled, and Visible are set to true for...
2
by: DougS | last post by:
I'm attempting to put a RequiredFieldValidator next to a text box on a user control. There will be a dozen of these controls added dynamically. At runtime I get this error: Unable to find...
2
by: Hongbo | last post by:
Hi, I have a Asp.Net written in C#. It serve as information input form. The form encounters sort of random problem with the email field and state field. I have validator attached with these 2...
1
by: Lloyd Dupont | last post by:
I have a composite control rougly like that:: ==== class BlogComments : Control, INamingContainer, IPostBackEventHandler { Panel pAddComment; TextBox tTitle; protected override void...
1
by: Giovanni | last post by:
Dear Friends, I need your help. I am trying to dynamically create a RequiredFieldValidator in the ItemCreated event of a DataList but cannot get it to work. The errors seem to revolve around...
2
by: Christina | last post by:
Hello !! I am creating a dynamic textbox and want to validate it using the requiredfieldvalidator. These are the steps which I tried: ==================================================== 1)...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.