Error on Registering Custom Validator

Discussion in 'ASP .Net' started by tshad, Sep 29, 2005.

  1. tshad

    tshad Guest

    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
     
    tshad, Sep 29, 2005
    #1
    1. Advertising

  2. tshad

    tshad Guest

    Nevermind.

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

    Tom
    "tshad" <> wrote in message
    news:...
    >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
    >
    >
    >
     
    tshad, Sep 29, 2005
    #2
    1. Advertising

  3. tshad

    tshad Guest

    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" <> wrote in message
    news:%...
    > Nevermind.
    >
    > I figured it out. I had Assembly="CustomValidators.dll" and I am not
    > supposed to have the .dll appended to it.
    >
    > Tom
    > "tshad" <> wrote in message
    > news:...
    >>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
    >>
    >>
    >>

    >
    >
     
    tshad, Sep 29, 2005
    #3
  4. 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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:%...
    >> Nevermind.
    >>
    >> I figured it out. I had Assembly="CustomValidators.dll" and I am not
    >> supposed to have the .dll appended to it.
    >>
    >> Tom
    >> "tshad" <> wrote in message
    >> news:...
    >>>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
    >>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    S. Justin Gengo, Sep 29, 2005
    #4
  5. tshad

    tshad Guest

    "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
    message news:...
    > 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" <> wrote in message
    > news:...
    >> 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" <> wrote in message
    >> news:%...
    >>> Nevermind.
    >>>
    >>> I figured it out. I had Assembly="CustomValidators.dll" and I am not
    >>> supposed to have the .dll appended to it.
    >>>
    >>> Tom
    >>> "tshad" <> wrote in message
    >>> news:...
    >>>>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
    >>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    tshad, Sep 29, 2005
    #5
  6. 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" <> wrote in message
    news:...
    > "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
    > message news:...
    >> 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" <> wrote in message
    >> news:...
    >>> 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" <> wrote in message
    >>> news:%...
    >>>> Nevermind.
    >>>>
    >>>> I figured it out. I had Assembly="CustomValidators.dll" and I am not
    >>>> supposed to have the .dll appended to it.
    >>>>
    >>>> Tom
    >>>> "tshad" <> wrote in message
    >>>> news:...
    >>>>>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
    >>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    S. Justin Gengo, Sep 30, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?cG11ZA==?=
    Replies:
    8
    Views:
    802
    =?Utf-8?B?cG11ZA==?=
    Feb 11, 2005
  2. Steve
    Replies:
    0
    Views:
    567
    Steve
    Sep 19, 2005
  3. Juan T. Llibre
    Replies:
    2
    Views:
    3,914
    =?Utf-8?B?UmljaA==?=
    Dec 16, 2006
  4. Dhanashree
    Replies:
    0
    Views:
    411
    Dhanashree
    Jan 31, 2007
  5. Scott Yenor

    How to get custom control to work with custom validator

    Scott Yenor, Jan 27, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    213
    Scott Yenor
    Jan 27, 2004
Loading...

Share This Page