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

P

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!
 
K

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
 
P

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
 
K

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
 
P

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,
 

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

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top