Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Parser Error

Reply
Thread Tools

Parser Error

 
 
Lubomir
Guest
Posts: n/a
 
      01-23-2005
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

 
Reply With Quote
 
 
 
 
Rowland Shaw
Guest
Posts: n/a
 
      01-25-2005
"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?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML::Parser Installation error: XML-Parser-2.34 Sean Perl Misc 3 10-03-2006 01:23 AM
XML::Parser Installation error: XML-Parser-2.34 Sean Perl Misc 0 10-02-2006 06:20 PM
XML Parser VS HTML Parser ZOCOR Java 11 10-05-2004 01:58 PM
XMLparser: Difference between parser.setErrorHandler() vs. parser.setContentHandler() Bernd Oninger Java 0 06-09-2004 01:26 AM
XMLparser: Difference between parser.setErrorHandler() vs. parser.setContentHandler() Bernd Oninger XML 0 06-09-2004 01:26 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57