Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
Binding UltraWebMenu From DataSet
posted

 Hi !

Please help me how to binding a UltraWebMenu from DataSet with struct "ID - ParentID". Thanks !

Parents
No Data
Reply
  • 175
    posted

    The formatting got screwed here is better version.

    private void LoadMenuItems()

    {

               

    DataSet dsMenuItems = new DataSet();

    try

    {

    //this method gets you the 2 datatables in the dataset

    GetMenu(ref dsMenuItems);

     

    dsMenuItems.DataSetName = "Menu";

    dsMenuItems.Tables[0].TableName = "MainMenu";

    dsMenuItems.Tables[1].TableName = "SubMenu";

    dsMenuItems.Relations.Add("RELATION", dsMenuItems.Tables[0].Columns["MAINMENUITEMID"],

    dsMenuItems.Tables[1].Columns["MAINMENUITEMID"], true);

     

    //populate the menu here

    if (dsMenuItems != null)

    {

     

    UltraWebMenu1.DataSource = dsMenuItems;//.Tables[0].DefaultView;

    //UltraWebMenu1.Levels[0].TargetUrlName = "NAVIGATIONURL";

    UltraWebMenu1.Levels[0].ColumnName = "MAINMENUITEMNAME";

    UltraWebMenu1.Levels[0].LevelKeyField = "MAINMENUITEMID";

    UltraWebMenu1.Levels[0].RelationName = "RELATION";

     

    UltraWebMenu1.Levels[1].TargetUrlName = "NAVIGATIONURL";

    UltraWebMenu1.Levels[1].ColumnName = "SUBMENUITEMNAME";

    UltraWebMenu1.Levels[1].LevelKeyField = "SUBMENUITEMID";

     

    UltraWebMenu1.DataMember = dsMenuItems.Tables[0].TableName;

    UltraWebMenu1.DataBind();

    }

    }

    catch (Exception ex)

    {

    }

    }

     

Children
No Data