asp.netvalidationapplication-blocks

PropertyProxyValidator error on int property


I'm using application blocks and i have a property that use a "Not Null Validator" and a "Range Validator".

Then in presentation tier I'm using this code:

<tr>
    <td width="30%">
        <asp:Label ID="MyLabel" runat="server" Text="My Property"></asp:Label>
    </td>
    <td>
        <asp:TextBox ID="MyTextBox" runat="server" Width="175px"></asp:TextBox>
        <cc1:PropertyProxyValidator ID="MyPropertyProxyValidator" runat="server" ControlToValidate="MyTextBox" SourceTypeName="MySourceTypeName" RulesetName="MyRulesetName" PropertyName="MyPropertyName">*</cc1:PropertyProxyValidator>
    </td>
</tr>

This code throw me an error: Is not a valid value for Int32.

I'm read and use this article: http://www.davidhayden.com/blog/dave/archive/2007/02/28/propertyproxyvalidatorvalueconvertevent.aspx but it doesn't work.

Note: The string and datetime properties work me correctly. Sorry for my english : )


Solution

  • Finally I found the problem, Is a little embarrassing, Is because I forgot fill the upperBound property of the Range Validator, I thought that if I put upperBoundType="Ignore" was no necesary put the upperBound, but not, you need fill with any value.

    I had this code in Web.config validation section:

    <validator type="XXXXX" culture="XXXXX" name="Range Validator" lowerBoundType="Inclusive" lowerBound="1" upperBoundType="Ignore" />
    

    And now I have this:

    <validator type="XXXXX" culture="XXXXX" name="Range Validator" lowerBoundType="Inclusive" lowerBound="1" upperBoundType="Ignore" upperBound="1" />
    

    Yupi!!! I win a "Tumbleweed" badge :s (sorry for my english)