Menu orientation horizontal and vertical
Menu is an asp.net web server control. menu control's Orientation property get or set the direction in which to render
the menu control. menu Orientation property value type is System.Web.UI.WebControls.Orientation. we need to assign a value to this
property from 'Orientation' enumeration values. Orientation enumeration specifies the general layout of items within a menu control.
Orientation enumeration have two possible values Horizontal and Vertical. Orientation property value Horizontal indicate the menu control is rendered horizontally. and Orientation property value Vertical specify the menu control is rendered vertically. we can set the property value as Orientation.Horizontal or Orientation.Vertical. this property allow us to render a horizontal or vertical layout menu on asp.net web page.
the following asp.net c# example code demonstrate us how can we set or change menu orientation horizontal or vertical programmatically at run time in an asp.net application.
Orientation enumeration have two possible values Horizontal and Vertical. Orientation property value Horizontal indicate the menu control is rendered horizontally. and Orientation property value Vertical specify the menu control is rendered vertically. we can set the property value as Orientation.Horizontal or Orientation.Vertical. this property allow us to render a horizontal or vertical layout menu on asp.net web page.
the following asp.net c# example code demonstrate us how can we set or change menu orientation horizontal or vertical programmatically at run time in an asp.net application.
MenuOrientation.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
Menu1.Orientation = Orientation.Horizontal;
Label1.Text = "Menu Orientation Now Horizontal";
}
protected void Button2_Click(object sender, System.EventArgs e)
{
Menu1.Orientation = Orientation.Vertical;
Label1.Text = "Menu Orientation Now Vertical";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to set, change Menu orientation (Horizontal, Vertical) programmatically</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy; font-style:italic;">Menu Example: Orientation</h2>
<asp:SiteMapDataSource
ID="SiteMapDataSource1"
runat="server"
/>
<div style="height:180px">
<asp:Label
ID="Label1"
runat="server"
Font-Bold="true"
Font-Italic="true"
Font-Size="Large"
ForeColor="DodgerBlue"
>
</asp:Label>
<br /><br />
<asp:Menu
ID="Menu1"
runat="server"
DataSourceID="SiteMapDataSource1"
Font-Bold="true"
ForeColor="Crimson"
>
</asp:Menu>
</div>
<asp:Button
ID="Button1"
runat="server"
ForeColor="SeaGreen"
Text="Horizontal Orientation"
Height="45"
OnClick="Button1_Click"
Font-Bold="true"
/>
<asp:Button
ID="Button2"
runat="server"
ForeColor="SeaGreen"
Text="Vertical Orientation"
Height="45"
OnClick="Button2_Click"
Font-Bold="true"
/>
</div>
</form>
</body>
</html>
Web.sitemap
Web.sitemap source code here.



- How to set, change dynamic menu style in Menu control programmatically
- How to set, change Menu maximum dynamic display levels programmatically
- How to set, change static pop out image url in Menu control
- How to set, change static top separator image url in Menu control
- How to use theme and skin in Menu control