ValidationSummary breaks validation?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • da

    #1

    ValidationSummary breaks validation?

    I've inherited an ASP.net 2.0 (VB.net) application that uses a lot of
    GridViews and DetailsViews.

    I've ran into an odd issue with validation. We've added some validators to
    the INSERT template to validate a field. They include a required field
    validator, a Regex validator checking the length of the field, and a custom
    validator.

    Each is then assigned to the same validation group. We then added a
    validationSumma ry referencing that same group.

    Here's the problem:

    If we assign the ValidationGroup to the validators, they stop validating. If
    w remove the ValidationGroup property, they then work just fine.

    3 of us have looked at this and we can't figure out what would be causing
    this. Any theories as to what is going on?

    -Darrel

  • Joern Schou-Rode

    #2
    Re: ValidationSumma ry breaks validation?

    On Mon, 03 Nov 2008 18:03:55 +0100, da <ihatespam@exam ple.comwrote:
    If we assign the ValidationGroup to the validators, they stop
    validating. If w remove the ValidationGroup property, they then work
    just fine.
    Did you set the ValidationGroup property of the Button (or whatever is
    causing the postback) as well?

    I am not sure what the expected behavior should be if the Button does not
    specify a ValidationGroup and but all validators do. Should the Button
    cause validation across all groups or no validation at all?

    --
    Joern Schou-Rode

    Comment

    • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

      #3
      Re: ValidationSumma ry breaks validation?

      a button with no validation group, will only call validators with no
      validation group.

      -- bruce (sqlwork.com)


      "Joern Schou-Rode" wrote:
      On Mon, 03 Nov 2008 18:03:55 +0100, da <ihatespam@exam ple.comwrote:
      >
      If we assign the ValidationGroup to the validators, they stop
      validating. If w remove the ValidationGroup property, they then work
      just fine.
      >
      Did you set the ValidationGroup property of the Button (or whatever is
      causing the postback) as well?
      >
      I am not sure what the expected behavior should be if the Button does not
      specify a ValidationGroup and but all validators do. Should the Button
      cause validation across all groups or no validation at all?
      >
      --
      Joern Schou-Rode

      >

      Comment

      • da

        #4
        Re: ValidationSumma ry breaks validation?

        Did you set the ValidationGroup property of the Button (or whatever is
        causing the postback) as well?
        No! That could be it.

        It's actually a EDITITEM template in a DETAILSVIEW control. The postback is
        being caused by the rendered INSERT link within the control itself.

        -Darrel

        Comment

        • da

          #5
          Re: ValidationSumma ry breaks validation?

          No! That could be it.
          >
          It's actually a EDITITEM template in a DETAILSVIEW control. The postback
          is being caused by the rendered INSERT link within the control itself.

          Ah! thanks for the hints! I think we've found what we were missing. Here's
          an example of what we had to add:

          Protected Sub dvActivityType_ ItemInserting(B yVal sender As Object, ByVal e
          As System.Web.UI.W ebControls.Deta ilsViewInsertEv entArgs) Handles
          dvActivityType. ItemInserting
          ' upon inserting item, we need to validate the group of fields in
          our view/template
          Page.Validate(" valActivityType ")
          ' if they are not valid cancel the event
          If Not Page.IsValid Then
          e.Cancel = True
          End If
          End Sub


          Comment

          • Jesse Houwing

            #6
            Re: ValidationSumma ry breaks validation?

            Hello da,
            I've inherited an ASP.net 2.0 (VB.net) application that uses a lot of
            GridViews and DetailsViews.
            >
            I've ran into an odd issue with validation. We've added some
            validators to the INSERT template to validate a field. They include a
            required field validator, a Regex validator checking the length of the
            field, and a custom validator.
            >
            Each is then assigned to the same validation group. We then added a
            validationSumma ry referencing that same group.
            >
            Here's the problem:
            >
            If we assign the ValidationGroup to the validators, they stop
            validating. If w remove the ValidationGroup property, they then work
            just fine.
            >
            3 of us have looked at this and we can't figure out what would be
            causing this. Any theories as to what is going on?
            >
            -Darrel

            The controls that cause the poastback (say the textboxes and/or the submit
            button) need to have the validation group set as well...
            --
            Jesse Houwing
            jesse.houwing at sogeti.nl


            Comment

            Working...