Validators and inherited pages (master page)

Discussion in 'ASP .Net' started by Shaun, Aug 13, 2004.

  1. Shaun

    Shaun Guest

    I am using a base page (I think they're also called master pages) as a
    base that my webforms inherit from. The base page controls formating
    and common functions used throughout the site. This all works great
    until I want to use a validator.

    Any validators added to the page do not fire. I can leave a required
    textbox blank, and the code happily chugs through processing the
    button click code.

    After some research, I've found that some say this is a bug with 1.1,
    where the validators do not get added back into the page.validators
    collection. The solution was to do it yourself in the base page in
    the init.

    I've done that, and it works, but it causes another problem. My
    itemCommand events for my datagrids then stop working.

    Any ideas on what the heck is going on here?
    Shaun, Aug 13, 2004
    1. Advertisements

  2. Shaun

    Scott Allen Guest

    Hi Shaun:

    I'm not sure if this is a bug or not - could you post a small code
    example that demonstrates the problem?

    Couple things come to mind:

    Are you checking Page.IsValid in your event handler? Validators won't
    stop the flow of control if the request reaches the server - you have
    to check this flag. Are you using client side validation?
    Scott Allen, Aug 14, 2004
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.