User Control

Discussion in 'ASP .Net Building Controls' started by IntraRELY, Nov 19, 2004.

  1. IntraRELY

    IntraRELY Guest

    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
     
    IntraRELY, Nov 19, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom Rowton
    Replies:
    2
    Views:
    695
    Tom Rowton
    Aug 1, 2003
  2. vatech1993
    Replies:
    4
    Views:
    5,720
    =?Utf-8?B?U8Opcmdpbw==?=
    Dec 11, 2004
  3. Replies:
    0
    Views:
    451
  4. Mad Scientist Jr
    Replies:
    0
    Views:
    674
    Mad Scientist Jr
    Mar 22, 2006
  5. Jonathan Wood

    User Control to Control Other User Control

    Jonathan Wood, Jan 24, 2010, in forum: ASP .Net
    Replies:
    4
    Views:
    581
    Jonathan Wood
    Feb 2, 2010
Loading...

Share This Page