Group your Validators

Paul Pascha, 5 maart 2009

When you’re building a WebPart that uses some of the ASP.NET validator controls, make sure you specify a validation group for all of them and for the Control firing the validation (i.e. the Submit button). Also, if you’re using a validation summary specify it’s validation group property too.

If you don’t do this, the validation might be fired by other controls rendered by SharePoint preventing you to navigate away from the page. I just ran into this since I created a new Page in a Publishing site. I added my WebPart to this Page and then I wanted to Publish the page. The “Submit for Approval” control in the “Page Editing Toolbar” fired the validation so I had to fill in all my required fields first in order to be able to enter the approval process.
So, I think it’s a best-practice to always use ValidationGroup inside of WebParts.

Geef een reactie

Jouw e-mailadres wordt niet gepubliceerd. Verplichte velden zijn gemarkeerd met *

*

De volgende HTML tags en attributen zijn toegestaan: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Categories

  • Tags

  • Blog Authors

    Amy
    anita
    Anneke
    Danny Burlage
    Dennis Vendel
    Freek Berson
    Gerard
    Iris
    Jasper Oosterveld
    Jean-Claude Chan
    Jorn
    Lab Chicks
    Luc Joziasse
    Maarten van Noort
    Maarten Wijsman
    Marlon
    Martijn Bellaard
    Natasja van Doorn
    Paul Pascha
    Peter Heuvelman
    Rick Slager
    Robert van Son
    Roeland Jimenez
    SanderZ
    Sjoerd Schudde
    Stefan van der Wiele
    Tim Heuperman
    Wortell
  • Archief