Error on Registering Custom Validator

T

tshad

I was looking at a Custom Validator that 4 Guys had posted that would solve
my RequiredValidator problem with CheckBoxLists and it says it can't find
the .dll. But the dll is in both the Bin folder and the same folder as the
..aspx page.

Here is the error:

Parser Error Message: File or assembly name CustomValidator.dll, or one of
its dependencies, was not found.
Line 6: <%@ Import Namespace="System.Data.SqlClient" %>
Line 7: <%@ Import Namespace="MyFunctions" %>
Line 8: <%@ Register TagPrefix="CustomValidators"
Namespace="CustomValidators" Assembly="CustomValidators.dll" %>
Line 9: <script runat="server">

The program is:
****************************************************************************
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

namespace CustomValidators
{
public class RequiredFieldValidatorForCheckBoxLists :
System.Web.UI.WebControls.BaseValidator
{
private ListControl _listctrl;

public RequiredFieldValidatorForCheckBoxLists()
{
base.EnableClientScript = false;
}

protected override bool ControlPropertiesValid()
{
Control ctrl = FindControl(ControlToValidate);

if (ctrl != null)
{
_listctrl = (ListControl) ctrl;
return (_listctrl != null);
}
else
return false; // raise exception
}

protected override bool EvaluateIsValid()
{
return _listctrl.SelectedIndex != -1;
}
}
}

******************************************************************************

And the compiler line is:

csc /t:library CustomValidators.cs /r:system.web.dll

It all compiles fine.

Why can't the .aspx page find it?

Thanks,

Tom
 
T

tshad

Nevermind.

I figured it out. I had Assembly="CustomValidators.dll" and I am not
supposed to have the .dll appended to it.

Tom
 
T

tshad

Well, it finds it fine, but it doesn't seem to work.

I even put "return false" at the beginning of both methods and it still
didn't raise any error - which it should have regardless of whether a box
was checked or not.

Does anyone know what I did wrong? It seems like a pretty straight forward
control.

Thanks,

Tom
 
S

S. Justin Gengo

Tshad,

If you didn't see my earlier post take a look. I have already built the
validator you need. Even if you don't want to use my object as is it is free
with source code so you can always just look at the code to see what you
need to do.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
T

tshad

S. Justin Gengo said:
Tshad,

If you didn't see my earlier post take a look. I have already built the
validator you need. Even if you don't want to use my object as is it is
free with source code so you can always just look at the code to see what
you need to do.

I couldn't find your post on the validator control, but I did look at your
site and found the section, so will look at it later today.

Thanks,

Tom
 
S

S. Justin Gengo

Tom,

You're welcome. The post was in reply to one of your own posts earlier in
the forum...

If you have any questions about the control fee free to email me.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top