How do I call the constructor of a User control?

F

Flare

I instantiate a UC like this.

-----
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="UCNetMenu.ascx.cs" Inherits="Sikkerhed.UCNetMenu" "%>
<%@ Register TagPrefix="cswm" Namespace="Coalesys.WebMenu"
Assembly="Coalesys.WebMenu" %>

<cswm:WebMenu id="NetMenu" runat="server" />
-----

And a Codebehind file listete below. But i need to have a constructer on the
UC., But how do i call this?

----- CODEBEHIND FILE
namespace Sikkerhed
{
using System;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Security.Principal;

public abstract class UCNetMenu : System.Web.UI.UserControl
{
InitializeMenu MenuSetup;
Coalesys.WebMenu.WebMenu NetMenu;

System.Security.Principal.GenericPrincipal bruger;

public UCNetMenu(ref System.Security.Principal.GenericPrincipal user)
<<<< How do i call this??? >>>>>
{
bruger = user;
}

private void Page_Load(object sender, System.EventArgs e)
{
MenuSetup = new InitializeMenu();

NetMenu.LoadState(Server.MapPath("./") + "\\netmenu.wms");

MenuSetup.SetPermissions(ref NetMenu,ref bruger);
}

#region Web Form Designer generated code
}
}
 

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

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top