all groups > asp.net building controls > july 2004 >
You're in the

asp.net building controls

group:

Web Custom Control error on ID field


Web Custom Control error on ID field Steve Mauldin
7/28/2004 10:32:13 AM
asp.net building controls: 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


Re: Web Custom Control error on ID field Juno
7/28/2004 4:36:22 PM
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.

--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET


"Steve Mauldin" <stevemauldin@hotmail.com> дÈëÏûÏ¢ÐÂÎÅ
:%23WHxOgLdEHA.1604@TK2MSFTNGP11.phx.gbl...
[quoted text, click to view]


AddThis Social Bookmark Button