Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > User Control

Reply
Thread Tools

User Control

 
 
IntraRELY
Guest
Posts: n/a
 
      11-19-2004
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,w idth=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,w idth=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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
Databinding in a user control that contains another user control StraussGuy@hotpop.com ASP .Net 0 01-07-2005 04:55 PM
Event not firing for user control inside user control vatech1993 ASP .Net 4 12-11-2004 02:51 PM
Manipulating a User Control from another User Control Tom Rowton ASP .Net 2 08-01-2003 08:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57