<%@ Register TagPrefix="ecd" Namespace="ASPNETExpert.WebControls.DemoControls" Assembly="ASPNETExpert.WebControls.DemoControls" %>
<%@ Register TagPrefix="ecd" TagName="Footer" Src="../../Controls/Footer.ascx"%>
<%@ Register TagPrefix="ecd" TagName="Header" Src="../../Controls/Header.ascx"%>
<%@ Register TagPrefix="ec" Namespace="ASPNETExpert.WebControls" Assembly="ASPNETExpert.WebControls" %>
<%@ Page language="c#" Inherits="ASPNETExpert.WebControls.Demo.Menu.Programming.FloatingMenu._default" CodeFile="default.aspx.cs" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>ASP.NET Menu : ExpertMenu Demo : Floating Menu</title>
<link href="../../style.css" type="text/css" rel="stylesheet">
</HEAD>
<body xmlns:ec="urn:http://aspnetexpert.com/ExpertControls.xsd">
<form id="Form1" method="post" runat="server">
<ecd:Header runat="server" ID="Header1"></ecd:Header>
<ec:ExpertMenu runat="server" id="ExpertMenu1" Skin="DarkBlue" PostBackOnClick="true" EnableViewState="false">
<Float Align="TopLeft" Offset-Horizontal="10" Offset-Vertical="5" />
<TopGroup>
<Items>
<ec:MenuItem Text="Top floating" PostBackOnClick="false">
<SubMenu>
<Items>
<ec:MenuItem Value="TopLeft" Text="Left" />
<ec:MenuItem Value="TopCenter" Text="Center" />
<ec:MenuItem Value="TopRight" Text="Right" />
</Items>
</SubMenu>
</ec:MenuItem>
<ec:MenuItem Text="Middle floatng" PostBackOnClick="false">
<SubMenu>
<Items>
<ec:MenuItem Value="MiddleLeft" Text="Left" />
<ec:MenuItem Value="MiddleCenter" Text="Center" />
<ec:MenuItem Value="MiddleRight" Text="Right" />
</Items>
</SubMenu>
</ec:MenuItem>
<ec:MenuItem Text="Bottom floating" PostBackOnClick="false">
<SubMenu>
<Items>
<ec:MenuItem Value="BottomLeft" Text="Left" />
<ec:MenuItem Value="BottomCenter" Text="Center" />
<ec:MenuItem Value="BottomRight" Text="Right" />
</Items>
</SubMenu>
</ec:MenuItem>
</Items>
</TopGroup>
</ec:ExpertMenu>
<br>
<ecd:DescriptionView runat="server" IconUrl="../../images/kv.gif" ID="Descriptionview1">
<ecd:Description id="Description1" runat="server">This example demonstrates a floating menu.</ecd:Description>
<ecd:Description id="Description2" runat="server">A menu that defines <B>Float</B> property
(of type <b>Float</b>) with <b>Float.Align</b> property set to value other than <B>None</B> is treated as a floating.</ecd:Description>
<ecd:Description id="Description3" runat="server"><B>Float</B> property defines which position on the
page the menu will have even when the page is scrolling or resizing.</ecd:Description>
<ecd:Description id="Description4" runat="server">Note how you can further adjust menu position with
<B>Float.Offset</B> property. </ecd:Description>
</ecd:DescriptionView>
<ec:CodeViewTab id="CodeViewTab1" runat="server" ImagesBaseUrl="../../images/tab/">
<ec:TabItem runat="server" Text="aspx">
<pre class="aspcode">
<ecd:SyntaxHighlight runat="server" ContentType="ASPX" OutputFile="default.aspx" />
</pre>
</ec:TabItem>
<ec:TabItem runat="server" Text="C#">
<pre class="aspcode">
<ecd:SyntaxHighlight runat="server" ContentType="C#" OutputFile="default.aspx.cs" />
</pre>
</ec:TabItem>
<ec:TabItem runat="server" Text="VB">
<pre class="aspcode">
<ecd:SyntaxHighlight runat="server" ContentType="VB" OutputFile="default_vb.aspx.vb" />
</pre>
</ec:TabItem>
</ec:CodeViewTab>
<ecd:Footer runat="server" ID="Footer1"></ecd:Footer>
</form>
</body>
</HTML>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using ASPNETExpert.WebControls;
using ASPNETExpert.WebControls.Style;
namespace ASPNETExpert.WebControls.Demo.Menu.Programming.FloatingMenu
{
///
/// Summary description for _default.
///
public partial class _default : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox MenuChoice;
protected void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.ExpertMenu1.MenuItemClick += new ASPNETExpert.WebControls.MenuEventHandler(this.ExpertMenu1_MenuItemClick);
}
#endregion
private void ExpertMenu1_MenuItemClick(object sender, ASPNETExpert.WebControls.MenuEventArgs eventArgs)
{
ExpertMenu1.Float.Align = (PlaneAlign)Enum.Parse(typeof(PlaneAlign), eventArgs.Item.Value);
if(ExpertMenu1.Float.Align.ToString().IndexOf("Bottom") >= 0)
{
(ExpertMenu1.Looks["Group"] as MenuGroupLook).ExpandDirection = ExpandDirection.AboveLeft;
ExpertMenu1.Float.Offset.Vertical = -Math.Abs(ExpertMenu1.Float.Offset.Vertical);
}
else
{
(ExpertMenu1.Looks["Group"] as MenuGroupLook).ExpandDirection = ExpandDirection.BelowLeft;
ExpertMenu1.Float.Offset.Vertical = Math.Abs(ExpertMenu1.Float.Offset.Vertical);
}
if(ExpertMenu1.Float.Align.ToString().IndexOf("Left") >= 0)
ExpertMenu1.Float.Offset.Horizontal = Math.Abs(ExpertMenu1.Float.Offset.Horizontal);
if(ExpertMenu1.Float.Align.ToString().IndexOf("Right") >= 0)
ExpertMenu1.Float.Offset.Horizontal = -Math.Abs(ExpertMenu1.Float.Offset.Horizontal);
}
}
}
Namespace ASPNETExpert.WebControls.DemoVB.Programming.FloatingMenu
Partial Class default_vb
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub ExpertMenu1_MenuItemSelected(ByVal sender As System.Object, ByVal eventArgs As ASPNETExpert.WebControls.MenuEventArgs) Handles ExpertMenu1.MenuItemClick
ExpertMenu1.Float.Align = DirectCast(System.Enum.Parse(GetType(ASPNETExpert.WebControls.Style.PlaneAlign), eventArgs.Item.Value), ASPNETExpert.WebControls.Style.PlaneAlign)
If ExpertMenu1.Float.Align.ToString().IndexOf("Bottom") >= 0 Then
CType(ExpertMenu1.Looks("Group"), MenuGroupLook).ExpandDirection = ExpandDirection.AboveLeft
ExpertMenu1.Float.Offset.Vertical = -Math.Abs(ExpertMenu1.Float.Offset.Vertical)
Else
CType(ExpertMenu1.Looks("Group"), MenuGroupLook).ExpandDirection = ExpandDirection.BelowLeft
ExpertMenu1.Float.Offset.Vertical = Math.Abs(ExpertMenu1.Float.Offset.Vertical)
End If
If ExpertMenu1.Float.Align.ToString().IndexOf("Left") >= 0 Then
ExpertMenu1.Float.Offset.Horizontal = Math.Abs(ExpertMenu1.Float.Offset.Horizontal)
End If
If (ExpertMenu1.Float.Align.ToString().IndexOf("Right") >= 0) Then
ExpertMenu1.Float.Offset.Horizontal = -Math.Abs(ExpertMenu1.Float.Offset.Horizontal)
End If
End Sub
End Class
End Namespace