Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Post
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Reply
how to create a submenu under Extra
Cassie Mod
6 years ago
203
Reply
HI ive got the following question, now we have a menu bar above the page containing a vew items. Underneeth extra i need a submenu item. How can i realize that ? here are some part the codes.
public
class
PortalMenuItemList: List<PortalMenuItem>
{
private
PortalMenuItem _Owner =
null
;
public
PortalMenuItemList(PortalMenuItem menuItem)
{
_Owner = menuItem;
}
public
new
void
Add(PortalMenuItem menuItem)
{
if
(menuItem.Parent!=
null
)
menuItem.Parent.Children.Remove(menuItem);
base
.Add(menuItem);
menuItem.Parent =
this
._Owner;
}
/*
public PortalMenuItem GetCommandByName(string commandName)
{
foreach(PortalCommand command in this)
{
PortalCommand temp = command.GetCommandByName(commandName);
if (temp != null)
return temp;
}
return null;
}*/
}
}
public
class
PortalMenuItem
{
public
string
Target;
private
PortalMenuItemList _Children;
public
PortalMenuItem()
{
Visible =
true
;
_Children =
new
PortalMenuItemList(
this
);
}
public
string
Title {
get
;
set
; }
public
PortalMenuItem Parent {
get
;
set
; }
public
string
Command {
get
;
set
; }
public
string
Class {
get
;
set
; }
public
bool
Visible {
get
;
set
; }
public
Dictionary<
string
,
string
> CommandArguments {
get
;
set
; }
public
PortalMenuItemList Children {
get
{
return
_Children; } }
}
public
override
void
InitMenu()
{
if
(UserLoggedIn)
{
var features =
new
Features(User);
switch
(User.loginType)
{
case
UserLoginType.User:
AddMenuItem(
new
PortalMenuItem
{
Command = ApplicationCommands.UserPhoneManagement,
Title =
"Mijn Toestel"
,
Class =
"phone"
,
Visible = (features.CallingDeliveryBlock || features.DoNotDisturb || features.CallForwardingAlways),
CommandArguments =
new
Dictionary<string, string>
{
{
"userId"
, User.username}
}
});
AddMenuItem(
new
PortalMenuItem
{
Command = ApplicationCommands.ReceptionistView,
Title =
"Receptionist"
,
Class =
"contacts"
,
Visible = features.Receptionist && (AuthorizeUser(User.username, null, ServicePacks.DeanReceptionistEnterprise) || AuthorizeUser(User.username, null, ServicePacks.DeanReceptionistSmallBusiness)),
Target =
"_blank"
});
AddMenuItem(
new
PortalMenuItem
{
Command = ApplicationCommands.HelpPage,
Title =
"Help"
,
Class =
"help"
,
Visible =
true
});
break
;
case
UserLoginType.Group:
case
UserLoginType.Partner:
case
UserLoginType.DeanOne:
AddMenuItem(
new
PortalMenuItem
{
Command = ApplicationCommands.UsersView,
Title =
"Gebruikers"
,
Class =
"phone"
,
Visible = features.ReadUsers
});
AddMenuItem(
new
PortalMenuItem
{
Command = ApplicationCommands.AutoAttendantsView,
Title =
"Keuzemenu"
,
Class =
"help"
,
Visible = features.AutoAttendentBasic
});
AddMenuItem(
new
PortalMenuItem
{
Command = ApplicationCommands.ExtraSettings,
Title =
"Extra"
,
Class =
"balloon"
,
});
break
;
}
}
}
// Topmenu.aspx
<%@ Control Language=
"C#"
AutoEventWireup=
"true"
CodeBehind=
"TopMenu.ascx.cs"
Inherits=
"OneXS.Orion.FrontOffice.Compleet.Portal.Controls.Topmenu"
%>
<%@ Import Namespace=
"OneXS.Orion.FrontOffice.Compleet.PortalBase"
%>
<%
if
(Repeater1.Items.Count != 0)
{%>
<div id=
"main_menu_wrap"
>
<div
class
=
"main_menu"
>
<ul>
<asp:Repeater ID=
"Repeater1"
runat=
"server"
EnableViewState=
"false"
>
<ItemTemplate>
<asp:PlaceHolder ID=
"PlaceHolder1"
runat=
"server"
Visible=
"<%# (Container.DataItem as PortalMenuItem).Visible %>"
>
<li
class
=
"<%# ComputeCssClass(Container.DataItem as PortalMenuItem) %>"
>
<a href=
"<%#ComputeMenuitemDocumentUrl(Container.DataItem as PortalMenuItem)%>"
title=
"<%#(Container.DataItem as PortalMenuItem).Title %>"
target=
"<%#(Container.DataItem as PortalMenuItem).Target %>"
>
<span
class
=
"icon icon-24 <%#(Container.DataItem as PortalMenuItem).Class %>"
></span>
<span
class
=
"label"
><%# ComputeMenuItemTitle(Container.DataItem as PortalMenuItem)%></span></a></li>
</asp:PlaceHolder>
</ItemTemplate>
</asp:Repeater>
</ul>
</div>
</div>
<% } %>
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
How implement Authentication in mvc
How to learn MVC framework in asp.net