Aug 8, 2007 at 9:21 AM
Hi all,
there is a way to use a NotNullValidator when a textbox validated from PropertyProxyValidator is empty?

Below an example:

[NotNullValidator(MessageTemplate = "Required Field")]
[StringLengthValidator(1, 200, MessageTemplate = "Length must be between {3}-{5}")]
public virtual string Description
get { return description; }
set { description = value; }

In the aspx page:
<radI:RadTextBox ID="txtDescription" runat="server" Width="200px" > </radI:RadTextBox>
<cc1:PropertyProxyValidator ID="ppvDescription" CssClass="errormessage" runat="server" PropertyName="Description" SourceTypeName="SF.Project.Lists.Entities.City" ControlToValidate="txtDescription"></cc1:PropertyProxyValidator>

If user don't type City Description I would show "Required field" and not "Length must be between 1-200".

Thanks in advance

Aug 8, 2007 at 8:30 PM
Hi Diego!

A TextBox empty have a String.Empty instead of Null value. This is why the NotNullValidator is not “validating” that.

You could use the NotNullValidator for validate a property of a entity class, for example: (see Not Null Validator topic in Enterprise Library Documentation)

public Company Manufacturer
                                return manufacturer;
                                manufacturer = value;

For more information about EntLib, please see this link

Hope it helps!

Sebastian Iacomuzzi