Problem Facing in Server Side Validation.

Discussion in 'ASP .Net Building Controls' started by msnews.microsoft.com, May 20, 2005.

  1. 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, May 20, 2005
    #1
    1. Advertising

  2. 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" <> wrote in message news:...
    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, May 20, 2005
    #2
    1. Advertising

  3. 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
    Steve Goodyear, May 21, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Colin Mackay
    Replies:
    0
    Views:
    2,677
    Colin Mackay
    Jun 25, 2003
  2. Matt
    Replies:
    14
    Views:
    4,069
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  3. msnews.microsoft.com

    Problem Facing in Server Side Validation.

    msnews.microsoft.com, May 20, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    507
    Peter Blum
    May 21, 2005
  4. =?Utf-8?B?dmlkeWE=?=
    Replies:
    1
    Views:
    740
    Kevin Spencer
    Jun 2, 2005
  5. msnews.microsoft.com

    Problem Facing in Server Side Validation.

    msnews.microsoft.com, May 20, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    112
    Steve Goodyear
    May 21, 2005
Loading...

Share This Page