Home > Archive > ASP .NET > September 2005 > Error on Registering Custom Validator
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Error on Registering Custom Validator
|
|
|
| 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
| |
|
| Nevermind.
I figured it out. I had Assembly="CustomValidators.dll" and I am not
supposed to have the .dll appended to it.
Tom
"tshad" <tscheiderich@ftsolutions.com> wrote in message
news:OjfQNeIxFHA.3864@TK2MSFTNGP12.phx.gbl...
>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
>
>
>
| |
|
| 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
"tshad" <tscheiderich@ftsolutions.com> wrote in message
news:%23UaMeiIxFHA.3300@TK2MSFTNGP09.phx.gbl...
> Nevermind.
>
> I figured it out. I had Assembly="CustomValidators.dll" and I am not
> supposed to have the .dll appended to it.
>
> Tom
> "tshad" <tscheiderich@ftsolutions.com> wrote in message
> news:OjfQNeIxFHA.3864@TK2MSFTNGP12.phx.gbl...
>
>
| |
| S. Justin Gengo 2005-09-28, 9:57 pm |
| 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
"tshad" <tscheiderich@ftsolutions.com> wrote in message
news:OQpe7zIxFHA.3252@TK2MSFTNGP10.phx.gbl...
> 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
>
> "tshad" <tscheiderich@ftsolutions.com> wrote in message
> news:%23UaMeiIxFHA.3300@TK2MSFTNGP09.phx.gbl...
>
>
| |
|
| "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:O7nwpzJxFHA.720@TK2MSFTNGP15.phx.gbl...
> 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
>
> --
> Sincerely,
>
> S. Justin Gengo, MCP
> Web Developer / Programmer
>
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzsche
> "tshad" <tscheiderich@ftsolutions.com> wrote in message
> news:OQpe7zIxFHA.3252@TK2MSFTNGP10.phx.gbl...
>
>
| |
| S. Justin Gengo 2005-09-29, 9:57 pm |
| 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
"tshad" <tscheiderich@ftsolutions.com> wrote in message
news:uWlqDASxFHA.2848@TK2MSFTNGP15.phx.gbl...
> "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
> message news:O7nwpzJxFHA.720@TK2MSFTNGP15.phx.gbl...
>
> 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
>
>
|
|
|
|
|