Home All Groups Group Topic Archive Search About

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

Author
4 Jan 2006 4:26 PM
Pipo
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!

Author
4 Jan 2006 4:34 PM
Karl Seguin
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/


Show quoteHide quote
"Pipo" <P***@home.com> wrote in message
news:%23$SPwuUEGHA.1120@TK2MSFTNGP11.phx.gbl...
> 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!
>
>
Author
4 Jan 2006 7:01 PM
Pipo
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

Show quoteHide quote
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schreef in bericht news:uyHVrzUEGHA.2320@TK2MSFTNGP11.phx.gbl...
> 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" <P***@home.com> wrote in message
> news:%23$SPwuUEGHA.1120@TK2MSFTNGP11.phx.gbl...
>> 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!
>>
>>
>
>
Author
4 Jan 2006 7:13 PM
Karl Seguin
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/


Show quoteHide quote
"Pipo" <P***@home.com> wrote in message
news:%23$SPwuUEGHA.1120@TK2MSFTNGP11.phx.gbl...
> 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!
>
>
Author
4 Jan 2006 7:49 PM
Pipo
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,

Show quoteHide quote
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schreef in bericht news:%23zRx3MWEGHA.208@tk2msftngp13.phx.gbl...
>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" <P***@home.com> wrote in message
> news:%23$SPwuUEGHA.1120@TK2MSFTNGP11.phx.gbl...
>> 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!
>>
>>
>
>