Question

I created a server control which consist only of fews buttons.

CWNavigation.vb

<ToolboxData("<{0}:CWNavigation runat=""server""></{0}:CWNavigation>")> _
<DefaultProperty("Id")> _
Public Class CWNavigation
    Inherits WebControl

I then referenced it in my ASPX page. Take note that the control are in the same solution, same project located in Commun/Navigation/CWNavigation.vb.

<%@ Register TagPrefix="NAV" TagName="CWNavigation" Src="~/Commun/Navigation/CWNavigation.vb" %>

I added it to the page.

<NAV:CWNavigation ID="CWNavigationService" runat="server" />

But the designer file along with the code-behind generate it as.

    Protected WithEvents CWNavigationService As Global.System.Web.UI.UserControl

But this is wrong.. it must be CWNavigation. Is there anything ive done wrong ?

Thanks!

Was it helpful?

Solution

Since its a custom Server Control you should register it as an assembly. Something like this...

<%@ Register Assembly="Control.Assembly.CWNavigation" TagPrefix="NAV" TagName="CWNavigation" Namespace="Namespace.Of.Control.Assembly" %>

Or add it to your ToolBox (Context Menu->Choose Items) and then drag and drop (which will have Visual Studio wire it up for you).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top