Web Custom Control error on ID field

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
 
J

Juno

Hi Steve,

I copied your code to vs.net and run them on my computer.They works fine.
So you may check if showgreen.dll is in bin folder.I think the aspx might
work on an old showgreen.dll that is in bin folder.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top