L
Lubomir
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
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