S
Steve Mauldin
I get the following error when trying to view in browser an aspx page that
has my simple Web Custom Control. If I remove the ID=Controlname from the
ASPX then the page and control displays correctly but I need to have id
fields to reference my web custom controls in code behind. Can someone tell
me what I maybe doing wrong to cause this error? I have included the Error
message, the web custom control code, the ASPX code, and the command line I
used to compile the Web Custom Control. Any help would be greatly
appreciated.
Thank you,
Steve Mauldin
<<<Error Message>>>
Server Error in '/Webtesting' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.
Parser Error Message: The base class includes the field 'ShowGreen1', but
its type (Webtesting.myControls.ShowGreen) is not compatible with the type
of control (Webtesting.myControls.ShowGreen).
Source Error:
Line 6: </HEAD>
Line 7: <body>
Line 8: <mycontrols:showgreen id="ShowGreen1" Runat="server">Hello
World!</mycontrols:showgreen>
Line 9: </body>
Line 10: </HTML>
Source File: c:\inetpub\wwwroot\Webtesting\DisplayShowGreen.aspx Line: 8
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573
<<<Web Custom Control Code>>>
Imports System
Imports System.Web
Imports System.Web.UI
Namespace myControls
Public Class ShowGreen : Inherits Control
Protected Overrides Sub Render(ByVal objTextWriter As HtmlTextWriter)
Dim strInnerText As String
If IsLiteralContent Then
strInnerText = CType(Controls(0), LiteralControl).Text
objTextWriter.AddAttribute("color", "green")
objTextWriter.RenderBeginTag("font")
objTextWriter.RenderBeginTag("b")
objTextWriter.Write(strInnerText)
objTextWriter.RenderEndTag()
objTextWriter.RenderEndTag()
End If
End Sub
End Class
End Namespace
<<<ASPX Code>>>
<%@ Register TagPrefix="myControls" Namespace="Webtesting.myControls"
Assembly="ShowGreen"%>
<%@ Page CodeBehind="DisplayShowGreen.aspx.vb" Language="vb"
AutoEventWireup="false" Inherits="Webtesting.DisplayShowGreen" %>
<HTML>
<HEAD>
<title>DisplayShowGreen.aspx</title>
</HEAD>
<body>
<myControls:showgreen id="ShowGreen1" Runat="server">Hello
World!</myControls:showgreen>
</body>
</HTML>
<<<Command Line Code>>>
C:\inetpub\wwwroot\Webtesting>vbc /t:library /rootnamespace:Webtesting
/r:system.dll,system.web.dll ShowGreen.vb
has my simple Web Custom Control. If I remove the ID=Controlname from the
ASPX then the page and control displays correctly but I need to have id
fields to reference my web custom controls in code behind. Can someone tell
me what I maybe doing wrong to cause this error? I have included the Error
message, the web custom control code, the ASPX code, and the command line I
used to compile the Web Custom Control. Any help would be greatly
appreciated.
Thank you,
Steve Mauldin
<<<Error Message>>>
Server Error in '/Webtesting' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.
Parser Error Message: The base class includes the field 'ShowGreen1', but
its type (Webtesting.myControls.ShowGreen) is not compatible with the type
of control (Webtesting.myControls.ShowGreen).
Source Error:
Line 6: </HEAD>
Line 7: <body>
Line 8: <mycontrols:showgreen id="ShowGreen1" Runat="server">Hello
World!</mycontrols:showgreen>
Line 9: </body>
Line 10: </HTML>
Source File: c:\inetpub\wwwroot\Webtesting\DisplayShowGreen.aspx Line: 8
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573
<<<Web Custom Control Code>>>
Imports System
Imports System.Web
Imports System.Web.UI
Namespace myControls
Public Class ShowGreen : Inherits Control
Protected Overrides Sub Render(ByVal objTextWriter As HtmlTextWriter)
Dim strInnerText As String
If IsLiteralContent Then
strInnerText = CType(Controls(0), LiteralControl).Text
objTextWriter.AddAttribute("color", "green")
objTextWriter.RenderBeginTag("font")
objTextWriter.RenderBeginTag("b")
objTextWriter.Write(strInnerText)
objTextWriter.RenderEndTag()
objTextWriter.RenderEndTag()
End If
End Sub
End Class
End Namespace
<<<ASPX Code>>>
<%@ Register TagPrefix="myControls" Namespace="Webtesting.myControls"
Assembly="ShowGreen"%>
<%@ Page CodeBehind="DisplayShowGreen.aspx.vb" Language="vb"
AutoEventWireup="false" Inherits="Webtesting.DisplayShowGreen" %>
<HTML>
<HEAD>
<title>DisplayShowGreen.aspx</title>
</HEAD>
<body>
<myControls:showgreen id="ShowGreen1" Runat="server">Hello
World!</myControls:showgreen>
</body>
</HTML>
<<<Command Line Code>>>
C:\inetpub\wwwroot\Webtesting>vbc /t:library /rootnamespace:Webtesting
/r:system.dll,system.web.dll ShowGreen.vb