Search code examples
asp.netaspmenu

How to Display The NavigationUrl of Menu on div


I have an ASP.net page designed like this as shown below:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="MyAccount.aspx.cs" Inherits="MyAccount" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <div style="width: 100%; height:100%;">

        <div style="float: left; height:100%; width: 80%;">
            xxxx
            <!-- Set Div As your requirement -->
        </div>
        <div style="float: right; width: 20%; height:100%; margin-left: 10px;">
        <asp:Menu dir="rtl" ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation=Vertical>
                    <Items>
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="xxxxxxxxxxxxxx"/>
                        <asp:MenuItem NavigateUrl="~/About.aspx" Text="yyyyyyyyyyyyyy "/>

                    </Items>
                </asp:Menu>
            <!-- Set Div As your requirement -->
        </div>

    </div>
</asp:Content>

I want the user to select any menu item, and to display the page in the left div.

Any idea?


Solution

  • You can call a javascript function in your navigateurl or onclick in case you are using Client Side Code

    See this example

    http://jsfiddle.net/UnGNc/1/