Creating Dynamic Menu in ASP.Net - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Thursday, July 21, 2011

Creating Dynamic Menu in ASP.Net

Introduction

To create a dynamic menu for the website we would use ASP Menu Control, we can't bind a Menu control directly to database data. Neither the SqlDataSource nor ObjectDataSource controls implement the IHierachicalDataSource interface. Therefore, if we want to represent database data with the Menu control, we need to perform some more work i.e. build the menu items programmatically in the Menu control. This is the approach followed here.


Imagine that you want to represent the contents of the database table with a


Menu control:

This database table represents menu items. The menu items are nested with the help Of the Parent column. For example, the customer menu item is nested under the User management as shown similarly the further nesting can also be done. 

LISTING 1.1 MenuDatabase.aspx

  

protected void Page_Load(object sender, EventArgs e)

    {

        #region Page-Load-Code

           

                if (!Page.IsPostBack)

                    PopulateTreeView();

        

No comments:

Post a Comment