Menu does not align horizontally with (Orientation)HorizontalAlign.Center

i have this menu that does not align horizontally but aligned vertically inspite of me putting

 menu.Orientation = (Orientation)HorizontalAlign.Center;

protected void Page_PreInit(object sender, EventArgs e)
        {
            Page.Theme = AdminLogin.GetTheme("Admin");

            if (!firsttimeload)
            {


                Page.Controls.Remove(Panel01);
                Page.DataBind();

                PopulateMenu();

                //firsttimeload = false;
            }
            else
            {
                PopulateMenu();
                firsttimeload = false;
            }
        }

    } 

void PopulateMenu()
        {
            #region Menu Generate

            using (SqlConnection sqlconn = new SqlConnection(connstring))
            {
                DataSet ds1 = new DataSet();

                //string strSQL1 = "select * from AdminMenuParentGrant where GrantPersonType = '" + Session["uname"] + "'";
                string strSQL1 = "select * from AdminMenuParentGrant where GrantPersonType = 'Admin'";
                SqlDataAdapter adapter1 = new SqlDataAdapter(strSQL1, sqlconn);
                adapter1.Fill(ds1);

                count_parentid = ds1.Tables[0].Rows.Count;

                for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
                {


                    list_parentid.Add(Convert.ToInt32(ds1.Tables[0].Rows[i]["PUniqueNumber"]));


                }

                DataSet ds3 = new DataSet();


                menu = new Menu();

                for (int j = 0; j < count_parentid; j++)
                {


                    string strSQL3 = "select * from AdminMenuParent WHERE UniqueNumber = " + list_parentid[j];
                    SqlDataAdapter adapter = new SqlDataAdapter(strSQL3, sqlconn);
                    adapter.Fill(ds3);

                    string sMenuParentItem = ds3.Tables[0].Rows[j]["MenuParentItem"].ToString();
                    string sCssStaticHoverStyle = ds3.Tables[0].Rows[j]["CssStaticHoverStyle"].ToString();
                    string sCssDynamicHoverStyle = ds3.Tables[0].Rows[j]["CssDynamicHoverStyle"].ToString();

                    string sMenuItemStyle1 = ds3.Tables[0].Rows[j]["MenuItemStyle1"].ToString();
                    string sMenuItemStyle2 = ds3.Tables[0].Rows[j]["MenuItemStyle2"].ToString();
                    string sMenuItemStyle3 = ds3.Tables[0].Rows[j]["MenuItemStyle3"].ToString();

                    MenuItem categoryItem = new MenuItem(sMenuParentItem);
                    menu.Items.Add(categoryItem);

                    menu.Orientation = (Orientation)HorizontalAlign.Center;
                   
                    menu.StaticHoverStyle.CssClass = sCssStaticHoverStyle;
                    menu.DynamicHoverStyle.CssClass = sCssDynamicHoverStyle;

                    MenuItemStyle menuitemstyle1 = new MenuItemStyle();
                    menuitemstyle1.CssClass = sMenuItemStyle1;

                    MenuItemStyle menuitemstyle2 = new MenuItemStyle();
                    menuitemstyle2.CssClass = sMenuItemStyle2;

                    MenuItemStyle menuitemstyle3 = new MenuItemStyle();
                    menuitemstyle3.CssClass = sMenuItemStyle3;

                    menu.LevelMenuItemStyles.Add(menuitemstyle1);
                    menu.LevelMenuItemStyles.Add(menuitemstyle2);
                    menu.LevelMenuItemStyles.Add(menuitemstyle3);

                    DataSet ds99 = new DataSet();
                    string strSQL99 = "Select * from AdminMenuChild where PUniqueNumber = " + list_parentid[j];
                    SqlDataAdapter adapter99 = new SqlDataAdapter(strSQL99, sqlconn);
                    adapter99.Fill(ds99);

                    for (int z = 0; z < ds99.Tables[0].Rows.Count; z++)
                    {
                        MenuItem childrenItem = new MenuItem(ds99.Tables[0].Rows[z]["MenuChildItem"].ToString());
                        childrenItem.NavigateUrl = ds99.Tables[0].Rows[z]["MenuURL"].ToString();
                        categoryItem.ChildItems.Add(childrenItem);
                    }

                    Panel01.Controls.Add(menu);
                    Panel01.DataBind();

                }


            }
            #endregion

        }

Open in new window

LVL 1
doramail05Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

robastaCommented:
Line 73 should be like this:

 menu.Orientation = Orientation.Horizontal;

not this:

    menu.Orientation = (Orientation)HorizontalAlign.Center;

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
masterpassCommented:
Can you try

menu.Orientation = Orientation.Horizontal;
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.