Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
F#
private void loaddata()
    {
 string strsql = "select * from dbo.MenuTable";
      // string strsql = "RadMenu1_ItemClick";

        SqlCommand cmd = new SqlCommand(strsql, sqlconn);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        sqlconn.Open();
        adp.Fill(dt);
        sqlconn.Close();
        RadMenu1.DataSource = dt;
        RadMenu1.DataTextField = dt.Columns["Solutions"].ToString() + dt.Columns["Home"].ToString();
        //RadMenu1.DataTextField = "Solutions" + "Home";
        RadMenu1.DataValueField = "Solutions" + "Home";
        RadMenu1.DataBind();
    }


I want to bind the menu from database...how can i??
Posted
Updated 19-Jul-12 23:42pm
v2
Comments
Malli_S 23-Jul-12 9:02am    
What problem/error/exception you are getting?

First of all, learn how to build menu and how to access databases, from your program. Hope you already know how to do that.
Think the menu as a tree. There are items, and items have children. A parent can have many children. But think a bit reverse. Children have parents. A child can have exactly one parent, no more. So, this is all.
Make the table: {menu item=""} {parent}. The root of menu will have parent null. That's all. The parent should be a foreign key, which points to the primary key of same table.
If you use MSSQL or Oracle, you can make recursive queries, that's all you have to know.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900