public Menu(int UserID) { Size MinButtonSize = new System.Drawing.Size(290, 30); InitializeComponent(); if (UserID <= 0) { Login l = new Login(); l.Show(); this.Hide(); } else { _userID = UserID; DB db = new DB(); db.AddParam("@UserID", UserID); DataTable dtMenu = db.SQLResults("usp_MenuGet"); foreach (DataRow dr in dtMenu.Rows) { Button btn = new Button(); btn.AutoSize = true; btn.BackColor = Color.Azure; btn.MinimumSize = MinButtonSize; btn.Text = dr["DisplayName"].ToString(); btn.Name = dr["MenuID"].ToString(); btn.Margin = new Padding(3,0,0,0); btn.Click += new EventHandler(btnMenu_Click); flpMenu.Controls.Add(btn); } } }
public Base(int UserID) { InitializeComponent(); if (UserID <= 0) { Login l = new Login(); l.Show(); this.Hide(); } else { this.pageHeader1.SetHeader("Base Page", UserID, this.Width); PopulateControls(); } }