 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 15th, 2004, 10:58 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Validator Issues
I have a page that initially loads with a simple dropdown and button, "Select". There are several controls that relate to the value that will be selected that are loaded invisible, to be revealed when the selection is made.
When the selection is made, the dropdown and button are disabled, so the user has a visual clue of what they selected, but cannot change it.
The controls relating are now made visible, and populated with appropriate data. Up to this point everything is peachy.
However, I have validation controls pointed to textboxes and a dropdown now. To make a long story short, they don't work. Among the controls made visible is another button, and I have a feeling that this is the source of the problem somehow.
Any ideas?
- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.
|
|

March 15th, 2004, 01:07 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
We might need the long story. How exactly are the validators not working?
|
|

March 15th, 2004, 01:53 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, the long story...
This is an edit page.
At design time (using VS.NET), the page gets a dropdown of edit options (via a databind in the pageLoad event) and a button. These controls are set both to visible and enabled as True
Also, the page has a textbox (to edit the selection text), a dropdown and another button. These controls are set to visible=false.
I have a required validator for the textbox and a compare validator for the second dropdown. These are initially set to visible=true, and enabled=false.
When the user chooses from the first dropdown, and then clicks on the first button, that button and the first dropdown are set to enabled=false (read only from now on). Then, the textbox, 2nd dropdown and 2nd button are set to visible=true and the validators are set to enabled=true.
At this point, the user enters their data and clicks the 2nd button to submit the changes. The required field validator for the textbox does not prevent blank entries - the 2nd button click event fires anyway.
The compare validator has a similar issue - it is comparing the 2nd dropdown to have a value greater than zero (I add in the pageLoad a first option of "Select..." with a value of zero).
Both validators fail - the form "passes" with an empty textbox and no selection in the 2nd dropdown.
Here are the validators:
<asp:CompareValidator id="CompareValidator1" style="Z-INDEX: 119; LEFT: 544px; POSITION: absolute; TOP: 496px"
runat="server" ErrorMessage="Selection is required" ValueToCompare="0" Operator="GreaterThan" ControlToCompare="ddlSelection"></asp:CompareValidator>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" style="Z-INDEX: 112; LEFT: 632px; POSITION: absolute; TOP: 374px"
runat="server" ErrorMessage="Link URL is required" ControlToValidate="txtLinkURL" Enabled="False"></asp:RequiredFieldValidator>
Long story, indeed :)
- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.
|
|

March 16th, 2004, 02:31 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I believe I can get the validators to work properly by checking the Page.IsValid property in the click event of the second button. I was under the impression, however, that the individual controls would function to prevent the click event code from firing if any of the controls were Invalid=True.
- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.
|
|

March 18th, 2004, 12:55 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
I thought you always had to check the Page.IsValid, because if the control specifies CausesValidation=True, then it automatically validates the page and always finishes the routine. However, I'm not completely sure.
|
|

April 26th, 2004, 01:47 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
i m facing the similler kind of problem.
My issue is that my validators are working on localhost absolutly fine but when ever i upload it to remote machine it vanishes.
I hve tried every thing here but not working..
Any solution is welcome
|
|

April 26th, 2004, 03:56 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
Quote:
quote:Originally posted by Shahzad_Hussain
Hi,
i m facing the similler kind of problem.
My issue is that my validators are working on localhost absolutly fine but when ever i upload it to remote machine it vanishes. 
I hve tried every thing here but not working..
Any solution is welcome
|
If its fine in localhost but not in server u should contact to ur Server provider or Domain Host administarator! excuse me but if u use Free host, they r not soppirting all that u have in ur localhost.
HTH, & keep in touch!
Always:),
Hovik Melkomian.
|
|
 |