Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   Problem Facing in Server Side Validation. (http://www.velocityreviews.com/forums/t757729-problem-facing-in-server-side-validation.html)

msnews.microsoft.com 05-20-2005 11:50 AM

Problem Facing in Server Side Validation.
 
Hi All,

I m facing problem in Server Side Validation.
For Example The Scenario is

I have two fields on the page
1 Country Dropdown List
2 Province Textbox
3 State Dropdown List

I put two validation controls on the page

1 one is RequiredFieldValidator for Province Textbox
2 second is CompareValidator for State Dropdown List

If the Country USA is selected then State should be validated whether a valid state is selected or not and Province Textbox should not validated.
If the Country other than USA is selected then Province Textbox is validated and State Dropdown List should not be validated.

But on the server when i call Page.Validate() method this validate both controls whatever is the Country is selected.
How can i disable the validation on ther server regarding of my choice.


Regards,
Muhammad Jamil Nawaz

msnews.microsoft.com 05-20-2005 12:10 PM

Re: Problem Facing in Server Side Validation.
 
I have done it by removing the relative validator from the page.validator collection on my choice.
If any one have any other idea then please tell me

Thanks
Muhammad Jamil Nawaz
"msnews.microsoft.com" <jamfiza12@hotmail.com> wrote in message news:eXNAvHTXFHA.2796@TK2MSFTNGP09.phx.gbl...
Hi All,

I m facing problem in Server Side Validation.
For Example The Scenario is

I have two fields on the page
1 Country Dropdown List
2 Province Textbox
3 State Dropdown List

I put two validation controls on the page

1 one is RequiredFieldValidator for Province Textbox
2 second is CompareValidator for State Dropdown List

If the Country USA is selected then State should be validated whether a valid state is selected or not and Province Textbox should not validated.
If the Country other than USA is selected then Province Textbox is validated and State Dropdown List should not be validated.

But on the server when i call Page.Validate() method this validate both controls whatever is the Country is selected.
How can i disable the validation on ther server regarding of my choice.


Regards,
Muhammad Jamil Nawaz

Steve Goodyear 05-21-2005 04:56 AM

Re: Problem Facing in Server Side Validation.
 
Hi Muhammad,

Removing the validator control will work or you can also set its Visible
property to false and you can also set its Enabled property to false. Either
of those would not cause a Validate event to fire during the Page.Validate.

RequiredFieldValidator1.Enabled = false;

Cheers,
Steve Goodyear


All times are GMT. The time now is 01:04 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.