Notice: Undefined offset: 0 in C:\webserver\www\towhid_info\blogs\blogs.php on line 75
How To create Dynamic Menus In Master Page ASP.NET
Home  • Programming • ASP.NET

How To create Dynamic Menus In Master Page ASP.NET

Step 1: First create an web application then using Microsoft Visual Studio. Step 2: Right click on Site.Master and then choose "View Markup" then clear all existing menu items inside the <asp:Menu> element. Step 3: Expend Site.Master from Solution Explorer. Step 4: Delete Site.Master.designer.cs Step 5: Right click on Site.Master then choose "Convert to Web Application" option and then Choose Yes Step 6: Right click on Site.Master.cs and then choose "View Code". Step 7: Then write the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            MenuItem home = new MenuItem();
            home.Text = "Home";
            home.NavigateUrl = @"~/Default.aspx";
            NavigationMenu.Items.Add(home);


            MenuItem about = new MenuItem();
            about.Text = "About";
            about.NavigateUrl = "~/About.aspx";
            NavigationMenu.Items.Add(about); ;

        }
    }
}

Warning: usort() expects exactly 2 parameters, 1 given in C:\webserver\www\towhid_info\include\pagination_lib.php on line 68

Comments 1


http://cybarlab.com/generate-dynamic-menu-in-asp-net-c-sharp

Share