Web Custom Control error on ID field

Discussion in 'ASP .Net Building Controls' started by Steve Mauldin, Jul 28, 2004.

  1. 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
    Steve Mauldin, Jul 28, 2004
    #1
    1. Advertising

  2. Steve Mauldin

    Juno Guest

    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" <> дÈëÏûÏ¢ÐÂÎÅ
    :%...
    > 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
    >
    >
    >
    Juno, Jul 29, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt Sokol
    Replies:
    2
    Views:
    375
    Theo Tillotson
    Aug 7, 2003
  2. Deniz Miscioglu
    Replies:
    1
    Views:
    165
    Deniz Miscioglu
    Oct 19, 2003
  3. Steve Mauldin

    Web Custom Control having error on ID field

    Steve Mauldin, Jul 28, 2004, in forum: ASP .Net Web Controls
    Replies:
    9
    Views:
    144
    Steve Mauldin
    Jul 29, 2004
  4. Sound
    Replies:
    2
    Views:
    436
    Randy Webb
    Sep 28, 2006
  5. jr
    Replies:
    3
    Views:
    414
Loading...

Share This Page