protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            List <Model_AppAction> ma = UsersController.GetActionAll();
            chklistStaff.DataSource     = ma.Where(a => a.ModuleID == 1);
            chklistStaff.DataTextField  = "Title";
            chklistStaff.DataValueField = "ActionID";
            chklistStaff.DataBind();

            CheckContentAction.DataSource     = ma.Where(a => a.ModuleID == 4);
            CheckContentAction.DataTextField  = "Title";
            CheckContentAction.DataValueField = "ActionID";
            CheckContentAction.DataBind();
            //dropRole.DataSource = UsersController.GetUserRole();
            //dropRole.DataTextField = "Title";
            //dropRole.DataValueField = "UsersRoleId";
            //dropRole.DataBind();

            //ListItem lis = new ListItem("All", "0");
            //dropRole.Items.Insert(0, lis);

            //if (!string.IsNullOrEmpty(Request.QueryString["s"]))
            //{
            //    Model_usersRole mu = UsersController.GetRoleByID(byte.Parse(Request.QueryString["s"]));

            //    if(mu != null)
            //    {
            //        RoleTitle.Text = mu.Title;
            //        //LastName.Text = mu.LastName;
            //        //UserName.Text = mu.UserName;
            //    }
            //}
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            //dropRole.DataSource = UsersController.GetUserRole();
            //dropRole.DataTextField = "Title";
            //dropRole.DataValueField = "UsersRoleId";
            //dropRole.DataBind();

            //ListItem lis = new ListItem("All", "0");
            //dropRole.Items.Insert(0, lis);

            if (!string.IsNullOrEmpty(Request.QueryString["s"]))
            {
                byte            id = byte.Parse(Request.QueryString["s"]);
                Model_usersRole mu = UsersController.GetRoleByID(id);

                if (mu != null)
                {
                    RoleTitle.Text = mu.Title;

                    status.SelectedValue = mu.Status.ToString();

                    //LastName.Text = mu.LastName;
                    //UserName.Text = mu.UserName;
                }

                List <Model_AppAction> ma = UsersController.GetActionAll();
                chklistStaff.DataSource     = ma.Where(a => a.ModuleID == 1);
                chklistStaff.DataTextField  = "Title";
                chklistStaff.DataValueField = "ActionID";
                chklistStaff.DataBind();

                CheckContentAction.DataSource     = ma.Where(a => a.ModuleID == 4);
                CheckContentAction.DataTextField  = "Title";
                CheckContentAction.DataValueField = "ActionID";
                CheckContentAction.DataBind();


                checksettingAction.DataSource     = ma.Where(a => a.ModuleID == 3);
                checksettingAction.DataTextField  = "Title";
                checksettingAction.DataValueField = "ActionID";
                checksettingAction.DataBind();


                List <Model_AppFeatureRole> RolApp = UsersController.GetAppFeature(id);

                if (RolApp.Count > 0)
                {
                    foreach (ListItem i in chklistStaff.Items)
                    {
                        i.Selected = (RolApp.Where(r => r.ActionID == int.Parse(i.Value) && r.ModuleID == 1).ToList().Count > 0);
                    }


                    foreach (ListItem i in CheckContentAction.Items)
                    {
                        i.Selected = (RolApp.Where(r => r.ActionID == int.Parse(i.Value) && r.ModuleID == 4).ToList().Count > 0);
                    }


                    foreach (ListItem i in checksettingAction.Items)
                    {
                        i.Selected = (RolApp.Where(r => r.ActionID == int.Parse(i.Value) && r.ModuleID == 3).ToList().Count > 0);
                    }
                }



                if (id == 10)
                {
                    List <CheckBoxList> allControls = new List <CheckBoxList>();
                    GetControlList <CheckBoxList>(Page.Controls, allControls);
                    foreach (var childControl in allControls)
                    {
                        CheckBoxList c = (CheckBoxList)childControl;
                        c.Enabled = false;
                    }

                    List <RadioButtonList> allControlsRadio = new List <RadioButtonList>();
                    GetControlList <RadioButtonList>(Page.Controls, allControlsRadio);
                    foreach (var childControl in allControlsRadio)
                    {
                        RadioButtonList c = (RadioButtonList)childControl;
                        c.Enabled = false;
                    }


                    List <Button> allControlsButton = new List <Button>();
                    GetControlList <Button>(Page.Controls, allControlsButton);
                    foreach (var childControl in allControlsButton)
                    {
                        Button c = (Button)childControl;
                        c.Enabled = false;
                    }

                    RoleTitle.Enabled = false;
                }
            }
        }
    }