I was able to create menu control with static menuitems. However, for my application, I need to dynamically set the menu items base on permission.
I have spent the whole evening trying to bind my dataset to EO Menu but I don't know what is missing as the page load event of my menu user control is not executed at all. Here is the asp page code:
<%@ Register TagPrefix="eo" Namespace="EO.Web" Assembly="EO.Web" %>
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="menu.ascx.vb" Inherits="XYZ.menucontrol" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http:
//www.w3.org/TR/html4/loose.dtd">
<table width="760" height="100" cellpadding="0" cellspacing="0" border="0" style="BACKGROUND-IMAGE: url(images/top_banner.jpg)">
<TR>
<TD align="left" width="600">
<eo:Menu id="Menu1" style="Z-INDEX: 2; LEFT: 110px; POSITION: relative; TOP: 22px" runat="server"
Width="647px" ControlSkinID="MSDN" SubMenuPositionConfine="None" RightToLeft="True" RaisesServerEvent="True">
<LookItems>
<eo:MenuItem ItemID="_TopGroup">
<SubMenu Style-CssText="font-weight:bold;"></SubMenu>
</eo:MenuItem>
<eo:MenuItem HoverStyle-CssText="color:#F7B00A;padding-left:5px;padding-right:5px;" ItemID="_TopLevelItem"
NormalStyle-CssText="padding-left:5px;padding-right:5px;">
<SubMenu Style-CssText="background-color:#f7f8f9;border-bottom-color:#e0e0e0;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#e0e0e0;border-left-style:solid;border-left-width:1px;border-right-color:#e0e0e0;border-right-style:solid;border-right-width:1px;border-top-color:#e0e0e0;border-top-style:solid;border-top-width:1px;color:#5f7786;cursor:hand;font-family:Arial;font-size:12px;padding-bottom:3px;padding-left:3px;padding-right:3px;padding-top:0px;"
OffsetX="40" ShadowDepth="4" OffsetY="-5" ItemSpacing="5"></SubMenu>
</eo:MenuItem>
</LookItems>
</eo:Menu>
</TD>
</TR>
</table>
The code behind in the page load event for menu.ascx:
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim objCmd = New SqlCommand("pt_menu")
With objCmd.Parameters
.Add(DBCreateParam("@securitycode", SqlDbType.VarChar, "admin"))
End With
Dim dr As DataSet = DBExecuteDataSet_Menu(objCmd)
' Specify the data source. Here we bind to the Menu. You
' can also bind to any sub menu.
Menu1.DataSource = dr
' Bind the "Website" column in the table to
' "NavigateUrl" property.
Dim binding As New EO.Web.DataBinding
Menu1.DataFields = "level1|level2|level3|level4"
binding.DataField = "menulink"
binding.Property = "NavigateUrl"
Menu1.Bindings.Add(binding)
' Populate from the data source (mainTable);
Menu1.DataBind()
End Sub 'Page_Load
Please advise.
Terry