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. |
Reply | Alert Moderator