Validator not working with configuration file.

Topics: Validation Application Block
May 17, 2007 at 3:15 PM
I already followed the quickstart, I have read a lot of doccumentation and I just give up, the scensario is, I have a web project which references a class library, the busines entitites are implemented on the class library, the library also has a businesslogic implementation, and this one is the one that the codebehind uses, then the business logic calls the data layer to insert on tables.

I have this on the web.config
<type assemblyName="LibPruebaEL, Version=, Culture=neutral, PublicKeyToken=null"
<ruleset name="Regla">
<property name="DSPerfil">
<validator lowerBound="1" lowerBoundType="Ignore" upperBound="3"
upperBoundType="Inclusive" negated="false" messageTemplate="Máximo 3 carácteres."
messageTemplateResourceName="" messageTemplateResourceType=""
tag="" type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.StringLengthValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="String Length Validator" />

and this on a page
<cc1:PropertyProxyValidator ID="PropertyProxyValidator1" runat="server" ControlToValidate="TextBox1"
PropertyName="DSPerfil" RulesetName="Regla" SourceTypeName="Avansoft.Cifin2.BusinessObjects.Perfil" SpecificationSource="Configuration"></cc1:PropertyProxyValidator></td>
<td style="width: 100px">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

but the validator never shows the message and always inserts the record.

My code behind is this.

BLPerfil objBlPerfil = new BLPerfil();
Perfil objPerfil = new Perfil();
objPerfil.IdPrioridad = Convert.ToInt32(TextBox2.Text);
objPerfil.DSPerfil = TextBox1.Text;
May 17, 2007 at 3:47 PM
I found why, but I need somebody to gives me an explanation please.

If I remove this from the validation section
, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

and from the config section, it works. Otherwise it doesnt!!

Strange for me!!