Error on Registering Custom Validator

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tshad

    Error on Registering Custom Validator

    I was looking at a Custom Validator that 4 Guys had posted that would solve
    my RequiredValidat or 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="Syst em.Data.SqlClie nt" %>
    Line 7: <%@ Import Namespace="MyFu nctions" %>
    Line 8: <%@ Register TagPrefix="Cust omValidators"
    Namespace="Cust omValidators" Assembly="Custo mValidators.dll " %>
    Line 9: <script runat="server">

    The program is:
    *************** *************** *************** *************** *************** *
    using System;
    using System.Web.UI;
    using System.Web.UI.W ebControls;
    using System.Componen tModel;

    namespace CustomValidator s
    {
    public class RequiredFieldVa lidatorForCheck BoxLists :
    System.Web.UI.W ebControls.Base Validator
    {
    private ListControl _listctrl;

    public RequiredFieldVa lidatorForCheck BoxLists()
    {
    base.EnableClie ntScript = false;
    }

    protected override bool ControlProperti esValid()
    {
    Control ctrl = FindControl(Con trolToValidate) ;

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

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

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

    And the compiler line is:

    csc /t:library CustomValidator s.cs /r:system.web.dl l

    It all compiles fine.

    Why can't the .aspx page find it?

    Thanks,

    Tom



  • tshad

    #2
    Re: Error on Registering Custom Validator

    Nevermind.

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

    Tom
    "tshad" <tscheiderich@f tsolutions.com> wrote in message
    news:OjfQNeIxFH A.3864@TK2MSFTN GP12.phx.gbl...[color=blue]
    >I was looking at a Custom Validator that 4 Guys had posted that would solve
    >my RequiredValidat or 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="Syst em.Data.SqlClie nt" %>
    > Line 7: <%@ Import Namespace="MyFu nctions" %>
    > Line 8: <%@ Register TagPrefix="Cust omValidators"
    > Namespace="Cust omValidators" Assembly="Custo mValidators.dll " %>
    > Line 9: <script runat="server">
    >
    > The program is:
    > *************** *************** *************** *************** *************** *
    > using System;
    > using System.Web.UI;
    > using System.Web.UI.W ebControls;
    > using System.Componen tModel;
    >
    > namespace CustomValidator s
    > {
    > public class RequiredFieldVa lidatorForCheck BoxLists :
    > System.Web.UI.W ebControls.Base Validator
    > {
    > private ListControl _listctrl;
    >
    > public RequiredFieldVa lidatorForCheck BoxLists()
    > {
    > base.EnableClie ntScript = false;
    > }
    >
    > protected override bool ControlProperti esValid()
    > {
    > Control ctrl = FindControl(Con trolToValidate) ;
    >
    > if (ctrl != null)
    > {
    > _listctrl = (ListControl) ctrl;
    > return (_listctrl != null);
    > }
    > else
    > return false; // raise exception
    > }
    >
    > protected override bool EvaluateIsValid ()
    > {
    > return _listctrl.Selec tedIndex != -1;
    > }
    > }
    > }
    >
    > *************** *************** *************** *************** *************** ***
    >
    > And the compiler line is:
    >
    > csc /t:library CustomValidator s.cs /r:system.web.dl l
    >
    > It all compiles fine.
    >
    > Why can't the .aspx page find it?
    >
    > Thanks,
    >
    > Tom
    >
    >
    >[/color]


    Comment

    • tshad

      #3
      Re: Error on Registering Custom Validator

      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@f tsolutions.com> wrote in message
      news:%23UaMeiIx FHA.3300@TK2MSF TNGP09.phx.gbl. ..[color=blue]
      > Nevermind.
      >
      > I figured it out. I had Assembly="Custo mValidators.dll " and I am not
      > supposed to have the .dll appended to it.
      >
      > Tom
      > "tshad" <tscheiderich@f tsolutions.com> wrote in message
      > news:OjfQNeIxFH A.3864@TK2MSFTN GP12.phx.gbl...[color=green]
      >>I was looking at a Custom Validator that 4 Guys had posted that would
      >>solve my RequiredValidat or 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="Syst em.Data.SqlClie nt" %>
      >> Line 7: <%@ Import Namespace="MyFu nctions" %>
      >> Line 8: <%@ Register TagPrefix="Cust omValidators"
      >> Namespace="Cust omValidators" Assembly="Custo mValidators.dll " %>
      >> Line 9: <script runat="server">
      >>
      >> The program is:
      >> *************** *************** *************** *************** *************** *
      >> using System;
      >> using System.Web.UI;
      >> using System.Web.UI.W ebControls;
      >> using System.Componen tModel;
      >>
      >> namespace CustomValidator s
      >> {
      >> public class RequiredFieldVa lidatorForCheck BoxLists :
      >> System.Web.UI.W ebControls.Base Validator
      >> {
      >> private ListControl _listctrl;
      >>
      >> public RequiredFieldVa lidatorForCheck BoxLists()
      >> {
      >> base.EnableClie ntScript = false;
      >> }
      >>
      >> protected override bool ControlProperti esValid()
      >> {
      >> Control ctrl = FindControl(Con trolToValidate) ;
      >>
      >> if (ctrl != null)
      >> {
      >> _listctrl = (ListControl) ctrl;
      >> return (_listctrl != null);
      >> }
      >> else
      >> return false; // raise exception
      >> }
      >>
      >> protected override bool EvaluateIsValid ()
      >> {
      >> return _listctrl.Selec tedIndex != -1;
      >> }
      >> }
      >> }
      >>
      >> *************** *************** *************** *************** *************** ***
      >>
      >> And the compiler line is:
      >>
      >> csc /t:library CustomValidator s.cs /r:system.web.dl l
      >>
      >> It all compiles fine.
      >>
      >> Why can't the .aspx page find it?
      >>
      >> Thanks,
      >>
      >> Tom
      >>
      >>
      >>[/color]
      >
      >[/color]


      Comment

      • S. Justin Gengo

        #4
        Re: Error on Registering Custom Validator

        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



        "Out of chaos comes order."
        Nietzsche
        "tshad" <tscheiderich@f tsolutions.com> wrote in message
        news:OQpe7zIxFH A.3252@TK2MSFTN GP10.phx.gbl...[color=blue]
        > 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@f tsolutions.com> wrote in message
        > news:%23UaMeiIx FHA.3300@TK2MSF TNGP09.phx.gbl. ..[color=green]
        >> Nevermind.
        >>
        >> I figured it out. I had Assembly="Custo mValidators.dll " and I am not
        >> supposed to have the .dll appended to it.
        >>
        >> Tom
        >> "tshad" <tscheiderich@f tsolutions.com> wrote in message
        >> news:OjfQNeIxFH A.3864@TK2MSFTN GP12.phx.gbl...[color=darkred]
        >>>I was looking at a Custom Validator that 4 Guys had posted that would
        >>>solve my RequiredValidat or 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="Syst em.Data.SqlClie nt" %>
        >>> Line 7: <%@ Import Namespace="MyFu nctions" %>
        >>> Line 8: <%@ Register TagPrefix="Cust omValidators"
        >>> Namespace="Cust omValidators" Assembly="Custo mValidators.dll " %>
        >>> Line 9: <script runat="server">
        >>>
        >>> The program is:
        >>> *************** *************** *************** *************** *************** *
        >>> using System;
        >>> using System.Web.UI;
        >>> using System.Web.UI.W ebControls;
        >>> using System.Componen tModel;
        >>>
        >>> namespace CustomValidator s
        >>> {
        >>> public class RequiredFieldVa lidatorForCheck BoxLists :
        >>> System.Web.UI.W ebControls.Base Validator
        >>> {
        >>> private ListControl _listctrl;
        >>>
        >>> public RequiredFieldVa lidatorForCheck BoxLists()
        >>> {
        >>> base.EnableClie ntScript = false;
        >>> }
        >>>
        >>> protected override bool ControlProperti esValid()
        >>> {
        >>> Control ctrl = FindControl(Con trolToValidate) ;
        >>>
        >>> if (ctrl != null)
        >>> {
        >>> _listctrl = (ListControl) ctrl;
        >>> return (_listctrl != null);
        >>> }
        >>> else
        >>> return false; // raise exception
        >>> }
        >>>
        >>> protected override bool EvaluateIsValid ()
        >>> {
        >>> return _listctrl.Selec tedIndex != -1;
        >>> }
        >>> }
        >>> }
        >>>
        >>> *************** *************** *************** *************** *************** ***
        >>>
        >>> And the compiler line is:
        >>>
        >>> csc /t:library CustomValidator s.cs /r:system.web.dl l
        >>>
        >>> It all compiles fine.
        >>>
        >>> Why can't the .aspx page find it?
        >>>
        >>> Thanks,
        >>>
        >>> Tom
        >>>
        >>>
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • tshad

          #5
          Re: Error on Registering Custom Validator

          "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate. com> wrote in
          message news:O7nwpzJxFH A.720@TK2MSFTNG P15.phx.gbl...[color=blue]
          > 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.[/color]

          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[color=blue]
          >
          > --
          > Sincerely,
          >
          > S. Justin Gengo, MCP
          > Web Developer / Programmer
          >
          > www.aboutfortunate.com
          >
          > "Out of chaos comes order."
          > Nietzsche
          > "tshad" <tscheiderich@f tsolutions.com> wrote in message
          > news:OQpe7zIxFH A.3252@TK2MSFTN GP10.phx.gbl...[color=green]
          >> 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@f tsolutions.com> wrote in message
          >> news:%23UaMeiIx FHA.3300@TK2MSF TNGP09.phx.gbl. ..[color=darkred]
          >>> Nevermind.
          >>>
          >>> I figured it out. I had Assembly="Custo mValidators.dll " and I am not
          >>> supposed to have the .dll appended to it.
          >>>
          >>> Tom
          >>> "tshad" <tscheiderich@f tsolutions.com> wrote in message
          >>> news:OjfQNeIxFH A.3864@TK2MSFTN GP12.phx.gbl...
          >>>>I was looking at a Custom Validator that 4 Guys had posted that would
          >>>>solve my RequiredValidat or 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="Syst em.Data.SqlClie nt" %>
          >>>> Line 7: <%@ Import Namespace="MyFu nctions" %>
          >>>> Line 8: <%@ Register TagPrefix="Cust omValidators"
          >>>> Namespace="Cust omValidators" Assembly="Custo mValidators.dll " %>
          >>>> Line 9: <script runat="server">
          >>>>
          >>>> The program is:
          >>>> *************** *************** *************** *************** *************** *
          >>>> using System;
          >>>> using System.Web.UI;
          >>>> using System.Web.UI.W ebControls;
          >>>> using System.Componen tModel;
          >>>>
          >>>> namespace CustomValidator s
          >>>> {
          >>>> public class RequiredFieldVa lidatorForCheck BoxLists :
          >>>> System.Web.UI.W ebControls.Base Validator
          >>>> {
          >>>> private ListControl _listctrl;
          >>>>
          >>>> public RequiredFieldVa lidatorForCheck BoxLists()
          >>>> {
          >>>> base.EnableClie ntScript = false;
          >>>> }
          >>>>
          >>>> protected override bool ControlProperti esValid()
          >>>> {
          >>>> Control ctrl = FindControl(Con trolToValidate) ;
          >>>>
          >>>> if (ctrl != null)
          >>>> {
          >>>> _listctrl = (ListControl) ctrl;
          >>>> return (_listctrl != null);
          >>>> }
          >>>> else
          >>>> return false; // raise exception
          >>>> }
          >>>>
          >>>> protected override bool EvaluateIsValid ()
          >>>> {
          >>>> return _listctrl.Selec tedIndex != -1;
          >>>> }
          >>>> }
          >>>> }
          >>>>
          >>>> *************** *************** *************** *************** *************** ***
          >>>>
          >>>> And the compiler line is:
          >>>>
          >>>> csc /t:library CustomValidator s.cs /r:system.web.dl l
          >>>>
          >>>> It all compiles fine.
          >>>>
          >>>> Why can't the .aspx page find it?
          >>>>
          >>>> Thanks,
          >>>>
          >>>> Tom
          >>>>
          >>>>
          >>>>
          >>>
          >>>[/color]
          >>
          >>[/color]
          >
          >[/color]


          Comment

          • S. Justin Gengo

            #6
            Re: Error on Registering Custom Validator

            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



            "Out of chaos comes order."
            Nietzsche
            "tshad" <tscheiderich@f tsolutions.com> wrote in message
            news:uWlqDASxFH A.2848@TK2MSFTN GP15.phx.gbl...[color=blue]
            > "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate. com> wrote in
            > message news:O7nwpzJxFH A.720@TK2MSFTNG P15.phx.gbl...[color=green]
            >> 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.[/color]
            >
            > 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[color=green]
            >>
            >> --
            >> Sincerely,
            >>
            >> S. Justin Gengo, MCP
            >> Web Developer / Programmer
            >>
            >> www.aboutfortunate.com
            >>
            >> "Out of chaos comes order."
            >> Nietzsche
            >> "tshad" <tscheiderich@f tsolutions.com> wrote in message
            >> news:OQpe7zIxFH A.3252@TK2MSFTN GP10.phx.gbl...[color=darkred]
            >>> 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@f tsolutions.com> wrote in message
            >>> news:%23UaMeiIx FHA.3300@TK2MSF TNGP09.phx.gbl. ..
            >>>> Nevermind.
            >>>>
            >>>> I figured it out. I had Assembly="Custo mValidators.dll " and I am not
            >>>> supposed to have the .dll appended to it.
            >>>>
            >>>> Tom
            >>>> "tshad" <tscheiderich@f tsolutions.com> wrote in message
            >>>> news:OjfQNeIxFH A.3864@TK2MSFTN GP12.phx.gbl...
            >>>>>I was looking at a Custom Validator that 4 Guys had posted that would
            >>>>>solve my RequiredValidat or 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="Syst em.Data.SqlClie nt" %>
            >>>>> Line 7: <%@ Import Namespace="MyFu nctions" %>
            >>>>> Line 8: <%@ Register TagPrefix="Cust omValidators"
            >>>>> Namespace="Cust omValidators" Assembly="Custo mValidators.dll " %>
            >>>>> Line 9: <script runat="server">
            >>>>>
            >>>>> The program is:
            >>>>> *************** *************** *************** *************** *************** *
            >>>>> using System;
            >>>>> using System.Web.UI;
            >>>>> using System.Web.UI.W ebControls;
            >>>>> using System.Componen tModel;
            >>>>>
            >>>>> namespace CustomValidator s
            >>>>> {
            >>>>> public class RequiredFieldVa lidatorForCheck BoxLists :
            >>>>> System.Web.UI.W ebControls.Base Validator
            >>>>> {
            >>>>> private ListControl _listctrl;
            >>>>>
            >>>>> public RequiredFieldVa lidatorForCheck BoxLists()
            >>>>> {
            >>>>> base.EnableClie ntScript = false;
            >>>>> }
            >>>>>
            >>>>> protected override bool ControlProperti esValid()
            >>>>> {
            >>>>> Control ctrl = FindControl(Con trolToValidate) ;
            >>>>>
            >>>>> if (ctrl != null)
            >>>>> {
            >>>>> _listctrl = (ListControl) ctrl;
            >>>>> return (_listctrl != null);
            >>>>> }
            >>>>> else
            >>>>> return false; // raise exception
            >>>>> }
            >>>>>
            >>>>> protected override bool EvaluateIsValid ()
            >>>>> {
            >>>>> return _listctrl.Selec tedIndex != -1;
            >>>>> }
            >>>>> }
            >>>>> }
            >>>>>
            >>>>> *************** *************** *************** *************** *************** ***
            >>>>>
            >>>>> And the compiler line is:
            >>>>>
            >>>>> csc /t:library CustomValidator s.cs /r:system.web.dl l
            >>>>>
            >>>>> It all compiles fine.
            >>>>>
            >>>>> Why can't the .aspx page find it?
            >>>>>
            >>>>> Thanks,
            >>>>>
            >>>>> Tom
            >>>>>
            >>>>>
            >>>>>
            >>>>
            >>>>
            >>>
            >>>[/color]
            >>
            >>[/color]
            >
            >[/color]


            Comment

            Working...