EntLib - VAB - PropertyProxyValidator not validating when ValidationGroup property is set

Topics: Validation Application Block
May 25, 2011 at 1:43 PM

Hi,

I was implementing the VAB in an ASP.Net sample project. And I noticed some weird behavior when I would set the ValidationGroup property on a PropertyProxyValidator.

Once set the validator doesn't seem to validate anymore. Has anyone else noticed this?

The below code is located within a formview's edit item template container

Validation runs:

<asp:TextBox ID="ReferentieEditTextBox" runat="server" Text='<%# Bind("Referentie") %>' ></asp:TextBox>
<cc1:PropertyProxyValidator ID="ReferentieEditValidator" runat="server" 
ControlToValidate="ReferentieEditTextBox" PropertyName="Referentie" RulesetName="Default" 
SourceTypeName="BusinessLogic.Data.Offerteaanvragen, BusinessLogic"> </cc1:PropertyProxyValidator>

Validation fails:

<asp:TextBox ID="ReferentieEditTextBox" runat="server" Text='<%# Bind("Referentie") %>' ValidationGroup="OfferteaanvragenValidationGroup"></asp:TextBox>

<cc1:PropertyProxyValidator ID="ReferentieEditValidator" 
runat="server" ControlToValidate="ReferentieEditTextBox"
PropertyName="Referentie" RulesetName="Default" 
SourceTypeName="BusinessLogic.Data.Offerteaanvragen, BusinessLogic" ValidationGroup="OfferteaanvragenValidationGroup">
</cc1:PropertyProxyValidator>
May 25, 2011 at 2:34 PM

Hi,

I was able to solve the problem by  adding the same ValidationGroup to the CommandButtons from the gridview.
So in this example:

<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" ValidationGroup="OfferteaanvragenValidationGroup"/>