Guest User

Guest User

  • Tech Writer
  • 529
  • 40.8k

C# Muliti Button Work On Side Menu Fix code..

Apr 26 2022 6:39 PM
private void DashBoard_Load(object sender, EventArgs e)
{
    rjDropdownMenuMenuConfiguration.IsMainMenu = true;
    rjDropdownMenuAdjustment.IsMainMenu = true;
    rjDropdownMenuAttendance.IsMainMenu = true;

    SideMenuPanel.Width = btn_SlideButton.Width;
    Btn_Dashboard.Enabled = false;
    Btn_Config.Enabled = false;
    Btn_Report.Enabled = false;
    Btn_Adjustment.Enabled = false;
    Btn_Attendance.Enabled = false;
    btnAbout.Enabled = false;

    int w = Screen.PrimaryScreen.Bounds.Width;
    int h = Screen.PrimaryScreen.Bounds.Height;
    this.Location = new Point(0, 0);
    this.Size = new Size(w, h);
}

THIS CODE WORK FINE

private void btn_SlideButton_Click(object sender, EventArgs e)
{
    if (SideMenuPanel.Width != btn_SlideButton.Width)
    {
        SideMenuPanel.Width = btn_SlideButton.Width;
        Btn_Dashboard.Enabled = false;
        Btn_Config.Enabled = false;
        Btn_Report.Enabled = false;
        Btn_Adjustment.Enabled = false;
        Btn_Attendance.Enabled = false;
        btnAbout.Enabled = false;
    }
    else
    {
        SideMenuPanel.Width = Btn_Dashboard.Width;
        Btn_Dashboard.Enabled = true;
        Btn_Config.Enabled = true;
        Btn_Report.Enabled = true;
        Btn_Adjustment.Enabled = true;
        Btn_Attendance.Enabled = true;
        btnAbout.Enabled = true;
    }
}

NOW I WILL SET ROLENAME

type A Code working Fine Administrator

Type U Code Not Work Correctly

if(Login.type == "A")
{
    if (SideMenuPanel.Width != btn_SlideButton.Width)
    {
        SideMenuPanel.Width = btn_SlideButton.Width;
        Btn_Dashboard.Enabled = false;
        Btn_Config.Enabled = false;
        Btn_Report.Enabled = false;
        Btn_Adjustment.Enabled = false;
        Btn_Attendance.Enabled = false;
        btnAbout.Enabled = false;
    }
    else
    {
       // SideMenuPanel.Width = Btn_Dashboard.Width;
        Btn_Dashboard.Enabled = true;
        Btn_Config.Enabled = true;
        Btn_Report.Enabled = true;
        Btn_Adjustment.Enabled = true;
        Btn_Attendance.Enabled = true;
        btnAbout.Enabled = true;
    }
}
else if(Login.type =="U")
{
    if (SideMenuPanel.Width != btn_SlideButton.Width)
    {
        SideMenuPanel.Width = btn_SlideButton.Width;
        Btn_Dashboard.Enabled = false;
        Btn_Config.Enabled = false;
        Btn_Report.Enabled = false;
        Btn_Adjustment.Enabled = false;
        Btn_Attendance.Enabled = false;
        btnAbout.Enabled = false;
    }
    else
    {
        //SideMenuPanel.Width = Btn_Dashboard.Width;
        Btn_Dashboard.Enabled = true;
        Btn_Config.Enabled = false;
       
        Btn_Report.Enabled = false;               
        Btn_Adjustment.Enabled = true;
        Btn_Attendance.Enabled = true;
        btnAbout.Enabled = true;
    }
}

 


Answers (1)