I really need to get this working......

Discussion in 'ASP .Net Building Controls' started by Pipo, Jan 4, 2006.

  1. Pipo

    Pipo Guest

    The problem:

    I create a very simple custom control:

    public class cLabel : System.Web.UI.WebControls.Label { }

    I place the cLabel in a user control.

    When I place the user control on a page I get this exception:



    Error Rendering Control - cLabel

    An unhandled exception has occurred.

    Unknown server tag 'cc1:cLabel'.



    So I tried to make a custom control which inherits from webcontrol:

    I create a very simple custom control:

    Designer(typeof(ControlDesigners))

    public class cELabel : WebControl { }

    And make a very simple designer for it.

    public class ControlDesigners : System.Web.UI.Design.ControlDesigner

    {

    public override string GetDesignTimeHtml()

    { StringWriter sw = new StringWriter();

    HtmlTextWriter tw = new HtmlTextWriter(sw);

    cLabel lbl = new cLabel();

    lbl.Text = "cLabel";

    lbl.RenderControl(sw);

    return sw.ToString();

    }

    }



    Now everything works fine within the user control.

    But when I place the cELabel into a panel in the user control I get the same
    damn error.



    I really need to get this working!



    Anyone know the 'bug'?

    Is there a solution?

    I am working with VS2005 (beta), can someone confirm this works in the final
    release?



    Tia!
     
    Pipo, Jan 4, 2006
    #1
    1. Advertising

  2. Pipo

    Karl Seguin Guest

    How is the control being registered?

    I'm able to successfully register controls using both global registration
    (new in 2.0, via web.config) and the 1.1 approach using @% Register

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Pipo" <> wrote in message
    news:%23$...
    > The problem:
    >
    > I create a very simple custom control:
    >
    > public class cLabel : System.Web.UI.WebControls.Label { }
    >
    > I place the cLabel in a user control.
    >
    > When I place the user control on a page I get this exception:
    >
    >
    >
    > Error Rendering Control - cLabel
    >
    > An unhandled exception has occurred.
    >
    > Unknown server tag 'cc1:cLabel'.
    >
    >
    >
    > So I tried to make a custom control which inherits from webcontrol:
    >
    > I create a very simple custom control:
    >
    > Designer(typeof(ControlDesigners))
    >
    > public class cELabel : WebControl { }
    >
    > And make a very simple designer for it.
    >
    > public class ControlDesigners : System.Web.UI.Design.ControlDesigner
    >
    > {
    >
    > public override string GetDesignTimeHtml()
    >
    > { StringWriter sw = new StringWriter();
    >
    > HtmlTextWriter tw = new HtmlTextWriter(sw);
    >
    > cLabel lbl = new cLabel();
    >
    > lbl.Text = "cLabel";
    >
    > lbl.RenderControl(sw);
    >
    > return sw.ToString();
    >
    > }
    >
    > }
    >
    >
    >
    > Now everything works fine within the user control.
    >
    > But when I place the cELabel into a panel in the user control I get the
    > same damn error.
    >
    >
    >
    > I really need to get this working!
    >
    >
    >
    > Anyone know the 'bug'?
    >
    > Is there a solution?
    >
    > I am working with VS2005 (beta), can someone confirm this works in the
    > final release?
    >
    >
    >
    > Tia!
    >
    >
     
    Karl Seguin, Jan 4, 2006
    #2
    1. Advertising

  3. Pipo

    Pipo Guest

    It is not a registration problem.
    Did you test this behaviour and did it work?
    Do you use VS2005 final release and can you conform this is working ??

    again, it is not the registration, I can register it also on both ways.
    If registration fails you'll get an different exception.

    Please look again and see if you'll get the same problem.
    Which version of VS do you use??

    thnx

    "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    schreef in bericht news:...
    > How is the control being registered?
    >
    > I'm able to successfully register controls using both global registration
    > (new in 2.0, via web.config) and the 1.1 approach using @% Register
    >
    > Karl
    >
    > --
    > MY ASP.Net tutorials
    > http://www.openmymind.net/
    >
    >
    > "Pipo" <> wrote in message
    > news:%23$...
    >> The problem:
    >>
    >> I create a very simple custom control:
    >>
    >> public class cLabel : System.Web.UI.WebControls.Label { }
    >>
    >> I place the cLabel in a user control.
    >>
    >> When I place the user control on a page I get this exception:
    >>
    >>
    >>
    >> Error Rendering Control - cLabel
    >>
    >> An unhandled exception has occurred.
    >>
    >> Unknown server tag 'cc1:cLabel'.
    >>
    >>
    >>
    >> So I tried to make a custom control which inherits from webcontrol:
    >>
    >> I create a very simple custom control:
    >>
    >> Designer(typeof(ControlDesigners))
    >>
    >> public class cELabel : WebControl { }
    >>
    >> And make a very simple designer for it.
    >>
    >> public class ControlDesigners :
    >> System.Web.UI.Design.ControlDesigner
    >>
    >> {
    >>
    >> public override string GetDesignTimeHtml()
    >>
    >> { StringWriter sw = new StringWriter();
    >>
    >> HtmlTextWriter tw = new HtmlTextWriter(sw);
    >>
    >> cLabel lbl = new cLabel();
    >>
    >> lbl.Text = "cLabel";
    >>
    >> lbl.RenderControl(sw);
    >>
    >> return sw.ToString();
    >>
    >> }
    >>
    >> }
    >>
    >>
    >>
    >> Now everything works fine within the user control.
    >>
    >> But when I place the cELabel into a panel in the user control I get the
    >> same damn error.
    >>
    >>
    >>
    >> I really need to get this working!
    >>
    >>
    >>
    >> Anyone know the 'bug'?
    >>
    >> Is there a solution?
    >>
    >> I am working with VS2005 (beta), can someone confirm this works in the
    >> final release?
    >>
    >>
    >>
    >> Tia!
    >>
    >>

    >
    >
     
    Pipo, Jan 4, 2006
    #3
  4. Pipo

    Karl Seguin Guest

    I didn't try your designer example, I stuck with the basic Label example.
    At home I have VS.NET Pro (rtm). At work I just tried on Visual Web
    Developer (rtm) and everything works.

    Here's what I have:

    cLabel.cs placed in App_Code
    namespace Test
    {
    public class cLabel : Label
    {
    }
    }


    ascx:
    <%@ Register TagPrefix="Test" Namespace="Test" %>
    <Test:cLabel ID="x" runat="Server">test</Test:cLabel>

    aspx:
    <%@ Register Src="WebUserControl.ascx" TagName="WebUserControl"
    TagPrefix="uc1" %>
    <uc1:WebUserControl ID="WebUserControl1" runat="server" />


    Everything works fine at design time and runs perfect on the browser.

    Karl
    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Pipo" <> wrote in message
    news:%23$...
    > The problem:
    >
    > I create a very simple custom control:
    >
    > public class cLabel : System.Web.UI.WebControls.Label { }
    >
    > I place the cLabel in a user control.
    >
    > When I place the user control on a page I get this exception:
    >
    >
    >
    > Error Rendering Control - cLabel
    >
    > An unhandled exception has occurred.
    >
    > Unknown server tag 'cc1:cLabel'.
    >
    >
    >
    > So I tried to make a custom control which inherits from webcontrol:
    >
    > I create a very simple custom control:
    >
    > Designer(typeof(ControlDesigners))
    >
    > public class cELabel : WebControl { }
    >
    > And make a very simple designer for it.
    >
    > public class ControlDesigners : System.Web.UI.Design.ControlDesigner
    >
    > {
    >
    > public override string GetDesignTimeHtml()
    >
    > { StringWriter sw = new StringWriter();
    >
    > HtmlTextWriter tw = new HtmlTextWriter(sw);
    >
    > cLabel lbl = new cLabel();
    >
    > lbl.Text = "cLabel";
    >
    > lbl.RenderControl(sw);
    >
    > return sw.ToString();
    >
    > }
    >
    > }
    >
    >
    >
    > Now everything works fine within the user control.
    >
    > But when I place the cELabel into a panel in the user control I get the
    > same damn error.
    >
    >
    >
    > I really need to get this working!
    >
    >
    >
    > Anyone know the 'bug'?
    >
    > Is there a solution?
    >
    > I am working with VS2005 (beta), can someone confirm this works in the
    > final release?
    >
    >
    >
    > Tia!
    >
    >
     
    Karl Seguin, Jan 4, 2006
    #4
  5. Pipo

    Pipo Guest

    thnx, Karl.
    I think that it is a VS2005 beta bug, then.
    tommorow I'll install the final!!!

    thnx again for your patience and your time.

    Greets,

    "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    schreef in bericht news:%...
    >I didn't try your designer example, I stuck with the basic Label example.
    >At home I have VS.NET Pro (rtm). At work I just tried on Visual Web
    >Developer (rtm) and everything works.
    >
    > Here's what I have:
    >
    > cLabel.cs placed in App_Code
    > namespace Test
    > {
    > public class cLabel : Label
    > {
    > }
    > }
    >
    >
    > ascx:
    > <%@ Register TagPrefix="Test" Namespace="Test" %>
    > <Test:cLabel ID="x" runat="Server">test</Test:cLabel>
    >
    > aspx:
    > <%@ Register Src="WebUserControl.ascx" TagName="WebUserControl"
    > TagPrefix="uc1" %>
    > <uc1:WebUserControl ID="WebUserControl1" runat="server" />
    >
    >
    > Everything works fine at design time and runs perfect on the browser.
    >
    > Karl
    > --
    > MY ASP.Net tutorials
    > http://www.openmymind.net/
    >
    >
    > "Pipo" <> wrote in message
    > news:%23$...
    >> The problem:
    >>
    >> I create a very simple custom control:
    >>
    >> public class cLabel : System.Web.UI.WebControls.Label { }
    >>
    >> I place the cLabel in a user control.
    >>
    >> When I place the user control on a page I get this exception:
    >>
    >>
    >>
    >> Error Rendering Control - cLabel
    >>
    >> An unhandled exception has occurred.
    >>
    >> Unknown server tag 'cc1:cLabel'.
    >>
    >>
    >>
    >> So I tried to make a custom control which inherits from webcontrol:
    >>
    >> I create a very simple custom control:
    >>
    >> Designer(typeof(ControlDesigners))
    >>
    >> public class cELabel : WebControl { }
    >>
    >> And make a very simple designer for it.
    >>
    >> public class ControlDesigners :
    >> System.Web.UI.Design.ControlDesigner
    >>
    >> {
    >>
    >> public override string GetDesignTimeHtml()
    >>
    >> { StringWriter sw = new StringWriter();
    >>
    >> HtmlTextWriter tw = new HtmlTextWriter(sw);
    >>
    >> cLabel lbl = new cLabel();
    >>
    >> lbl.Text = "cLabel";
    >>
    >> lbl.RenderControl(sw);
    >>
    >> return sw.ToString();
    >>
    >> }
    >>
    >> }
    >>
    >>
    >>
    >> Now everything works fine within the user control.
    >>
    >> But when I place the cELabel into a panel in the user control I get the
    >> same damn error.
    >>
    >>
    >>
    >> I really need to get this working!
    >>
    >>
    >>
    >> Anyone know the 'bug'?
    >>
    >> Is there a solution?
    >>
    >> I am working with VS2005 (beta), can someone confirm this works in the
    >> final release?
    >>
    >>
    >>
    >> Tia!
    >>
    >>

    >
    >
     
    Pipo, Jan 4, 2006
    #5
    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. Amir
    Replies:
    3
    Views:
    602
  2. Pipo
    Replies:
    4
    Views:
    647
  3. nc
    Replies:
    1
    Views:
    505
    nice.guy.nige
    Feb 3, 2005
  4. Replies:
    30
    Views:
    1,002
    Arne Vajhøj
    Feb 10, 2008
  5. Pipo

    I really need to get this working......

    Pipo, Jan 4, 2006, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    110
Loading...

Share This Page