开发者

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>开发者_如何学Go
        <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 : )


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜