473,804 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dinamic control validation

I have to make a survey and I have te following problem.

For each question in a subject (our survey had multiple subjects) I add a
radiobuttonlist and a requerdvieldval idator to te control collection. After
the page is posted back the result is saved and the control collection is
cleard and filled with a new subject. Now when the page is loaded all the
validators are showing up even before any input is given. It feels like
onload validation but I cant't find a thing on that and have no clue how to
stop the validator to show up on second pageload.

Anyone ideas about that?
Feb 23 '07 #1
3 1174
"Pieter" wrote ...
For each question in a subject (our survey had multiple subjects) I add a
radiobuttonlist and a requerdvieldval idator to te control collection.
After
the page is posted back the result is saved and the control collection is
cleard and filled with a new subject. Now when the page is loaded all the
validators are showing up even before any input is given. It feels like
onload validation but I cant't find a thing on that and have no clue how
to
stop the validator to show up on second pageload.
Its doing what is supposed to according to your description - you've
returned to the page, after posting, but you've cleared all the values, so
that validators are saying "ok - we've posted, and look at all these fields
that haven't been selected"..

Not sure if it'll work, but you could try setting the "InitialVal ue" on each
of the validators, for example,if you have drop down lists, and the first
item is "Please Select" with a value of 0 (zero) - then set the initial
value on the validator as 0 (zero) - see if that helps - when you reload
your page and have cleared all of your controls, I'm assuming that you
repopulate with these values?

Rob
Feb 23 '07 #2
What a do is not clearing anything I just remove all controls and add new
ones, with divrend id's .

The sultution I figured out is this:

Protected Overrides Sub Render(ByVal writer As System.Web.UI.H tmlTextWriter)
For Each v As IValidator In Me.Page.Validat ors
v.IsValid = True
Next
MyBase.Render(w riter)
End Sub

It's not the niced way but it's working
Regards Pieter

"Rob Meade" wrote:
"Pieter" wrote ...
For each question in a subject (our survey had multiple subjects) I add a
radiobuttonlist and a requerdvieldval idator to te control collection.
After
the page is posted back the result is saved and the control collection is
cleard and filled with a new subject. Now when the page is loaded all the
validators are showing up even before any input is given. It feels like
onload validation but I cant't find a thing on that and have no clue how
to
stop the validator to show up on second pageload.

Its doing what is supposed to according to your description - you've
returned to the page, after posting, but you've cleared all the values, so
that validators are saying "ok - we've posted, and look at all these fields
that haven't been selected"..

Not sure if it'll work, but you could try setting the "InitialVal ue" on each
of the validators, for example,if you have drop down lists, and the first
item is "Please Select" with a value of 0 (zero) - then set the initial
value on the validator as 0 (zero) - see if that helps - when you reload
your page and have cleared all of your controls, I'm assuming that you
repopulate with these values?

Rob
Feb 23 '07 #3
"Pieter" wrote...
What a do is not clearing anything I just remove all controls and add new
ones, with divrend id's .
I see, maybe it still has the values of the previous controls in the
viewstate then?

Glad you've got a solution anyway :o)

Rob
Feb 23 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3036
by: dddddd | last post by:
i need do create simple dinamic site - built mainly of pictures(they are the only dinamic part). pictuers differ by the -Location- and by -Time- (in which they were taken)... so on the index page visitor should have 2 choices (how the pictures will be arranged) (1) by time (2) by location the webmaster will only copy the pictures in folder
3
2535
by: Jose Garcia | last post by:
Hi there, Can somebody explain me how can i use matrixes with dinamic memory? I use malloc and free (NOT new & delete). I want to access to the matrix like Matrix but i don't know how to do that with pointers and malloc & free... If I declare 4 statics matrixs of 576x720, the program brokes down (how is it posible!?), so i must use dinamic memory (i suppose)...
6
2042
by: gp | last post by:
Hi all, I'm using Microsoft Visual C++ 6.0, I would like to see, debugging my project, all the elements of my dinamic objects.... I have a dinamic array and a STL vector and I need to know the fields values at a specific position, but in the Watch windows I can only see the first element...
6
3711
by: Nedu N | last post by:
Hi, I want to have confirmation(Yes/No) on a button of the webform in which there are many validation controls. I want all the validation controls to be triggered first and then Yes/No confirmation message. By adding just an confirm attribute for 'onclick' event of the button doesn't work with validation controls. Is there any short way to go around this. Thanks Nedu
2
3923
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow javascript checks for things like valid e-mail addresses or phone numbers (without having to add a separate control for validation). One idea I did some work on was having the control implement the IValidator interface and basically recreating...
7
2876
by: A.M | last post by:
Hi, I have a validation control in my page that upon any invalid data, it disables all buttons in the page. basicly i don't have any postback in the page if the validator finds any error. How can have the validator just disable certain control's postback and other part of page continue their functionality. Thanks,
2
1139
by: NWx | last post by:
Hi, I have a form with few controls, few validation controls and a validation summary control I set-up appropriate Messages in Validations controls. However, if validation fails, I just want to display a * in validation control (or any other character), and instead display all validation messages in Validation summary control.
2
3740
by: Barbara Alderton | last post by:
I setup some standard Required Field Validation controls and one Custom validation control on an ASP.NET page (within a user control) to validate text entry. I also setup a Summary Control to post all the messages to a message box (ShowMessageBox=true). The required field validation error messages show up in the summary just fine but I can't get the custom validation message to show up if invalid. So far I have the summary control...
2
6290
by: c676228 | last post by:
Hi, I have several user controls like email, phone,ssn etc. each has it's own validation message in its user control already. When I bring all those user controls in an aspx page, I would like to display a summary error messages using validation summary in an aspx page, how to do that? Thank you. -- Betty
0
9711
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10087
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9166
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.