How to use proxypropertyvalidator to validate a property of the entity in WCSF?

Topics: Web Client Software Factory
Jul 20, 2007 at 8:32 AM
hi all, here is my current situation,

i am using WCSF and Enterprise library 3.1. i got a entity class (PEMS.CallReason.Entities.CallReasonInfo) which i make the properties wrapped by the validation application block.
ie (VB)
<NotNullValidator(messageTemplate:="Cannot be empty", Ruleset:="Primary")> _
<StringLengthValidator(3, RangeBoundaryType.Inclusive, 10, RangeBoundaryType.Inclusive, messageTemplate:="Min 3, Max 10", Ruleset:="Primary")> _
Public Property ReaCode() As String
Return reacode
End Get

Set(ByVal value As String)
reacode = value
End Set
End Property

and i got an gridview for displaying data. i make use of the <EmptyDataTemplate> of gridview and put a detailview inside. the detailview is used for inserting data.
i bind a propertyproxyvalidator to the textbox control

<cc1:PropertyProxyValidator ID="ReaCodeValidator" runat="server" PropertyName="ReaCode" RulesetName="Primary"
SourceTypeName="PEMS.CallReason.Entities.CallReasonInfo" ValidationGroup="InsertValidationControls" ControlToValidate="txtAddReaCode" ErrorMessage="error" SetFocusOnError="true" >#</cc1:PropertyProxyValidator>--%>

the propertyproxyvalidation can work, however, i cant display the error message and it just clears my textboxes.

i can get the validation to work by traditional validators

<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtAddReaCode"
ErrorMessage="You must provide the reacode" validationGroup="InsertValidationControls"> * </asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator2" runat="server" ControlToValidate="txtAddReaCode"
ErrorMessage="The reacode must be greater than or equal to zero and cannot include the currency symbol"
Operator="GreaterThanEqual" Type="String" ValueToCompare="3" ValidationGroup="InsertValidationControls">* cannot less than 3 </asp:CompareValidator>

may i know is it not support by propertyproxyvalidor to work on detailview or just my wrong syntax/handling?
i really wan to use propertyproxyvalidator, i can get it work on normal forms. but it seems cant be run inside a detailview...

please help