Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   Parser Error (http://www.velocityreviews.com/forums/t757405-parser-error.html)

Lubomir 01-23-2005 10:37 PM

Parser Error
 
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


Rowland Shaw 01-25-2005 04:35 PM

RE: Parser Error
 
"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?


All times are GMT. The time now is 10:37 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.