dynamic horizontal offset value in Menu control
Menu is an asp.net web server control. menu control DynamicHorizontalOffset property get or set a number of
pixels to shift a dynamic menu horizontally relative to its parent menu item. this property value data type is System.Int32.
this integer value represents the number of pixels to shift a dynamic menu horizontally relative to its parent item. the DynamicHorizontalOffset property default value is 0 (zero). we can use this property to adjust the horizontal position of a dynamic menu relative to its parent menu item.
the following asp.net c# example code demonstrate us how can we set or change menu control horizontal offset value programmatically at run time in an asp.net application.
this integer value represents the number of pixels to shift a dynamic menu horizontally relative to its parent item. the DynamicHorizontalOffset property default value is 0 (zero). we can use this property to adjust the horizontal position of a dynamic menu relative to its parent menu item.
the following asp.net c# example code demonstrate us how can we set or change menu control horizontal offset value programmatically at run time in an asp.net application.
MenuDynamicHorizontalOffset.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
Menu1.DynamicHorizontalOffset = 10;
Label1.Text = "DynamicHorizontalOffset Now 10";
}
protected void Button2_Click(object sender, System.EventArgs e)
{
Menu1.DynamicHorizontalOffset = 20;
Label1.Text = "DynamicHorizontalOffset Now 20";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to set, change dynamic horizontal offset value in Menu control</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy; font-style:italic;">Menu Example: DynamicHorizontalOffset</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="Crimson"
>
</asp:Label>
<br /><br />
<asp:Menu
ID="Menu1"
runat="server"
DataSourceID="SiteMapDataSource1"
Font-Bold="true"
ForeColor="Brown"
>
</asp:Menu>
</div>
<asp:Button
ID="Button1"
runat="server"
ForeColor="SaddleBrown"
Text="DynamicHorizontalOffset 10"
Height="45"
OnClick="Button1_Click"
Font-Bold="true"
/>
<asp:Button
ID="Button2"
runat="server"
ForeColor="SaddleBrown"
Text="DynamicHorizontalOffset 20"
Height="45"
OnClick="Button2_Click"
Font-Bold="true"
/>
</div>
</form>
</body>
</html>
Web.sitemap
Web.sitemap source code here.



- How to set, change Menu data source (DataSourceID) programmatically
- How to set, change Menu dynamic hover style programmatically
- How to set, change dynamic menu item style in Menu control
- How to set, change static top separator image url in Menu control
- How to set, change static hover style in Menu control programmatically
- How to use theme and skin in Menu control