Welcome Guest Search | Active Topics | Sign In | Register

EO MENU DATA BINDING Options
Terrence
Posted: Wednesday, June 23, 2010 2:21:15 AM
Rank: Member
Groups: Member

Joined: 6/23/2010
Posts: 18

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:
Code: Visual Basic.NET
//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
eo_support
Posted: Wednesday, June 23, 2010 7:41:50 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Terrence wrote:

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.


Page_Load is a standard ASP.NET event, whether it is executed definitely has nothing to do with the Menu. So you may want to try your code without the menu at all and try get the event working first.

Once you get the Page_Load working, you can try to copy code from our samples to get the Menu working. After you get both working, you can start to switch the data source to your real data source.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.