bind sub menu with database

Posted by Rimjhim_3 under ASP.NET on 10/4/2012 | Points: 10 | Views : 2565 | Status : [Member] | Replies : 2
how to bind menu from database in asp 2.0?
after this i want to display sub menu on the mouse hover in the menu items?
after this i want to display sub sub menu on the mouse hover on the sub menu items?
thanks in advance




Responses

Posted by: Wadhwanisanju on: 10/4/2012 [Member] Starter | Points: 25

Up
0
Down
Hello,

Its very easy task not a big deal.

Now i ll show you how to achieve nested upto n-level menu dynamically with SQL Server.

Step 1:

Create a table called "Menu" having following Cols.

-- MenuID,
-- MenuName
-- Desc,
-- ParentID (nullable or 0 by default)
-- URL

Step 2 :

Load this data into dataset via select query into dataset.

DataSet ds = new DataSet();

ds = db1.ExecuteDataSet(command1);
ds.DataSetName = "Menus";

ds.Tables[0].TableName = "Menu";
DataRelation relation = new DataRelation("ParentChild",

ds.Tables["Menu"].Columns["MenuID"],
ds.Tables["Menu"].Columns["ParentID"]., true);

relation.Nested = true;

ds.Relations.Add(relation);

xmlDataSource.Data = ds.GetXml();


Now you will get the XML Structure having nested relation inside. Just try to bind this XML Structure with Menu Control of .NET and see the result.

IF YOU SATISFY BY THIS ANS PLEASE MAKE SURE MARK AS ANSWER.


Rimjhim_3, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rimjhim_3 on: 10/5/2012 [Member] Starter | Points: 25

Up
0
Down
i m new in asp..............
can u please send me the source file????????

Rimjhim_3, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response