473,396 Members | 2,087 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.

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 requerdvieldvalidator 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 1155
"Pieter" wrote ...
For each question in a subject (our survey had multiple subjects) I add a
radiobuttonlist and a requerdvieldvalidator 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 "InitialValue" 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.HtmlTextWriter)
For Each v As IValidator In Me.Page.Validators
v.IsValid = True
Next
MyBase.Render(writer)
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 requerdvieldvalidator 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 "InitialValue" 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
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...
3
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...
6
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...
6
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...
2
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...
7
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...
2
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...
2
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.