User Control

I

IntraRELY

I have built a user control which contains a menu (ComponentArt -
Web.UI.Menu 2.0). Here is the sueto code for the .ascx page:

manageMenu.ascx:
--
CODE BEHIND
--
Public globalRoleId As Integer
Page_Load
If Not IsPostBack Then
If globalRoleId = 1 Then
build_webadminMenu()...
ElseIf globalRoleId = 2 Then
build_managersMenu()...
End If
End If
End Sub

Private Sub build_webadminMenu()
' Create the "Create" menu label
Dim menuTopLabelCreate As New ComponentArt.Web.UI.MenuItem
menuTopLabelCreate.Text = "Create"
defaultMenu.Items.Add(menuTopLabelCreate)
' Create sub-items
' Create the sub-menu item Create/Product(productsCreate.aspx)
Dim menuItemCreateProduct As New ComponentArt.Web.UI.MenuItem
menuItemCreateProduct.Text = "Product"
menuItemCreateProduct.ClientSideCommand =
"window.open('productsCreate.aspx',1,'height=550,width=750,menubar=no,status=no,toolbar=no')"
menuTopLabelCreate.Items.Add(menuItemCreateProduct)
End Sub

Private Sub build_managersMenu()
' Create the "Create" menu label
Dim menuTopLabelCreate As New ComponentArt.Web.UI.MenuItem
menuTopLabelCreate.Text = "Create"
defaultMenu.Items.Add(menuTopLabelCreate)
' Create sub-items
' Create the sub-menu item Create/Product(productsCreate.aspx)
Dim menuItemCreateProduct As New ComponentArt.Web.UI.MenuItem
menuItemCreateProduct.Text = "Product"
menuItemCreateProduct.ClientSideCommand =
"window.open('productsCreate.aspx',1,'height=550,width=750,menubar=no,status=no,toolbar=no')"
menuTopLabelCreate.Items.Add(menuItemCreateProduct)
End Sub


**I can embed the usercontrol and works when I hard code the "globalRoleId"
to either 1 or 2. However, I need to pass this from the default.aspx page.

Default.aspx
--
HTML
--
<%@ Register TagPrefix="uc1" TagName="manageMenu" Src="manageMenu.ascx" %>
....
<body MS_POSITIONING="GridLayout">
<form id=Form1 method=post runat="server">
<uc1:manageMenu id=ManageMenu1 roleId=1 runat="server"></uc1:manageMenu>
</form>
</body>

CODE BEHIND
' Need to pass the roleId from here (the roleId is created here and have
access to it from w/in default.aspx). But, not sure how to pass the roleId
to the ManageMenu.ascx and the user control and have it draw the customized
menu based on the roleId.

TIA,

Steve
 

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,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top