Parser Error

Discussion in 'ASP .Net Building Controls' started by Lubomir, Jan 23, 2005.

  1. Lubomir

    Lubomir Guest

    Hi,

    I have a custom control, defined in the file LinkLabel.cs, compiled into
    assembly MyControl.dll

    namespace MyControl
    {
    [DefaultProperty("Text"), ToolboxData("<{0}:LinkLabel
    runat=server></{0}:LinkLabel>")]
    public class LinkLabel : Label
    {
    …..
    }
    .....
    }
    The control’s dll is in a bin directory of the web page, which will use it.

    In my “asp†page I registered control:
    <%@ Register TagPrefix="mspo" Namespace="MyControl" Assembly="MyControl" %>

    and used the control:
    <mspo:LinkLabel id="LinkLabel1" runat="server" ></mspo:LinkLabel>

    In code behind:
    protected MyControl.LinkLabel LinkLabel1;
    …..
    LinkLabel1.Text = "blablabla";

    I can compile my web page with no error, however, when I run it, I get a
    parser error:

    Parser Error Message: The base class includes the field 'LinkLabel1', but
    its type (MyControl.LinkLabel) is not compatible with the type of control
    (MyControl.LinkLabel).

    Source error line:
    <mspo:LinkLabel id="LinkLabel1" runat="server" ></mspo:LinkLabel>

    Please note, that the types mentioned in Parser Error Message are identical.
    When I change the definition of a control object in codebehind class
    from
    protected MyControl.LinkLabel LinkLabel1;

    To
    protected Label LinkLabel1; // Label is the base class for LinkLabel

    everything is good.

    What is wrong with the parser when I use inherited, LinkLabel class?

    Thanks for a help.

    Lubomir
     
    Lubomir, Jan 23, 2005
    #1
    1. Advertising

  2. Lubomir

    Rowland Shaw Guest

    "Lubomir" wrote:
    > I have a custom control, defined in the file LinkLabel.cs, compiled into
    > assembly MyControl.dll
    >
    > The control’s dll is in a bin directory of the web page, which will use it.
    >
    > I can compile my web page with no error, however, when I run it, I get a
    > parser error:
    >
    > Parser Error Message: The base class includes the field 'LinkLabel1', but
    > its type (MyControl.LinkLabel) is not compatible with the type of control
    > (MyControl.LinkLabel).
    >
    > Please note, that the types mentioned in Parser Error Message are identical.


    Are you referencing the same assembly at compile time to that being used at
    runtime?
     
    Rowland Shaw, Jan 25, 2005
    #2
    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. Bernd Oninger
    Replies:
    0
    Views:
    762
    Bernd Oninger
    Jun 9, 2004
  2. ZOCOR

    XML Parser VS HTML Parser

    ZOCOR, Oct 3, 2004, in forum: Java
    Replies:
    11
    Views:
    817
    Paul King
    Oct 5, 2004
  3. Bernd Oninger
    Replies:
    0
    Views:
    812
    Bernd Oninger
    Jun 9, 2004
  4. Sean
    Replies:
    3
    Views:
    278
    robic0
    Oct 3, 2006
  5. Sean
    Replies:
    0
    Views:
    369
Loading...

Share This Page