I have a Repeater
with a TextBox
and a RegularExpressionValidator
(REV) on every row. I bind the validationexpression for REVs in the aspx by doing,
<asp:RegularExpressionValidator ID="regexTeam" ErrorMessage="myerrormessage"
ValidationGroup="ValidationGroup1" Display="None"
ControlToValidate="txtTeam" runat="server"
ValidationExpression='<%# MyNamespace.Constants.RegularExpression.myvalidationexpressionconstant %>'>
</asp:RegularExpressionValidator>
This works fine.
Now I have another place(not within the Repeater
) with the same kind of TextBox
and an REV. I do the same:
<asp:RegularExpressionValidator ID="regexStatus" ErrorMessage="myerrormessage"
ValidationGroup="ValidationGroup2" Display="None"
ControlToValidate="txtStatus" runat="server"
ValidationExpression='<%# MyNamespace.Constants.RegularExpression.myvalidationexpressionconstant %>'>
</asp:RegularExpressionValidator>
The second one does not work. It does not accept any input. In the page source, there is no regexstatus.validationexpression
. The regexteam.validationexpression
exists as expected. Any ideas?
PS: The constants are defined in a separate project in a struct. I cannot make it a static class.