protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string TabId = GridView1.DataKeys[e.Row.RowIndex].Value.ToString();
                string RoleId = ddlRoleList.SelectedValue;
                int PermissionId = Convert.ToInt32(ddlPermissionList.SelectedValue);
                string SelectedTabId = null, UserId = null;
                ModulePermissions module_permission_obj = new ModulePermissions();
                DataTable dt = module_permission_obj.GetListByRoleIdPermissionId(RoleId, PermissionId);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    SelectedTabId = dt.Rows[i]["TabId"].ToString();
                    UserId = dt.Rows[i]["UserId"].ToString();



                    if (TabId == SelectedTabId)
                    {
                        CheckBox chkSelectedPermissionRight = (CheckBox)e.Row.Cells[2].FindControl("chkSelectedPermissionRight");
                        if (chkSelectedPermissionRight != null)
                            chkSelectedPermissionRight.Checked = true;

                        CheckBox chkSelectedAllowAccessRight = (CheckBox)e.Row.Cells[3].FindControl("chkSelectedAllowAccessRight");
                        if (chkSelectedAllowAccessRight != null)
                            chkSelectedAllowAccessRight.Checked = true;

                        //TextBox txtUserId = (TextBox)e.Row.Cells[4].FindControl("txtUserId");
                        //txtUserId.Text = UserId;
                        //txtUserId.Attributes.Add("value", txtUserId.Text);

                        string ApplicationId = ddlApplicationList.SelectedValue;
                        DropDownList ddlUserList = (DropDownList)e.Row.FindControl("ddlUserList");
                        UserController user_obj = new UserController();
                        DataTable dt_app = user_obj.GetUsers(ApplicationId);
                        ddlUserList.DataSource = dt_app;
                        ddlUserList.DataTextField = "UserName";
                        ddlUserList.DataValueField = "UserId";
                        ddlUserList.DataBind();
                        ddlUserList.Items.Insert(0, new ListItem("- Chọn -", ""));
                        if (UserId != string.Empty)
                            ddlUserList.SelectedValue = UserId;
                        else
                            ddlUserList.SelectedIndex = 0;
                    }
                }
            }
        }
 private void PopulateUserList(DropDownList ddlUserList, string selected_value)
 {
     string ApplicationId = ddlApplicationList.SelectedValue;
     UserController user_obj = new UserController();
     DataTable dt_app = user_obj.GetUsers(ApplicationId);            
     ddlUserList.Items.Clear();
     ddlUserList.DataSource = dt_app;
     ddlUserList.DataTextField = "UserName";
     ddlUserList.DataValueField = "UserId";
     ddlUserList.DataBind();
     ddlUserList.Items.Insert(0, new ListItem("- Chọn -", ""));
     if (selected_value != string.Empty)
         ddlUserList.SelectedValue = selected_value;
     else
         ddlUserList.SelectedIndex = 0;
 }
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string ID = GridView1.DataKeys[e.Row.RowIndex].Value.ToString();              
                e.Row.Attributes["ondblclick"] = "this.style.background='#BFFF00';ShowEditModal('" + ID + "');";
                //e.Row.Attributes.Add("onmouseover", "MouseEvents(this, event)");
                //e.Row.Attributes.Add("onmouseout", "MouseEvents(this, event)");  
                //e.Row.Attributes["onmousedown"] = "this.style.background='#FACC2E';";
                //e.Row.Attributes["onmouseclick"] = "this.style.background='##228b22';this.style.color='#FFFFFF';";

                DropDownList ddlUserList = (DropDownList)e.Row.FindControl("ddlUserList"); 
                ddlUserList.Items.Clear();
                string ApplicationId = ddlApplicationList.SelectedValue;
                UserController user_obj = new UserController();
                DataTable dt_app = user_obj.GetUsers(ApplicationId);
                ddlUserList.DataSource = dt_app;
                ddlUserList.DataTextField = "UserName";
                ddlUserList.DataValueField = "UserId";
                ddlUserList.DataBind();
                if (Session["UserId"] != null && Session["UserId"].ToString() != string.Empty)
                    ddlUserList.SelectedValue = Session["UserId"].ToString();
                else
                    ddlUserList.Items.Insert(0, new ListItem("- Chọn -", ""));
                ddlUserList.SelectedIndex = 0;            
            }

            //if(e.Row.RowType != DataControlRowType.Header && e.Row.RowType != DataControlRowType.Footer && e.Row.RowType != DataControlRowType.Pager)
            //{
            //    e.Row.Cells[0].Text = "<input type=\"checkbox\" value=\"" + e.Row.Cells[1].Text + "\" name=\"chkRecordId\" id=\"chkRecordId\"/>";
            //}
        }
        public CascadingDropDownNameValue[] GetUserList(string knownCategoryValues, string category)
        {
            StringDictionary dataValues = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
            string ApplicationId = dataValues["ApplicationId"];
            UserController user_obj = new UserController();
            DataTable dt = user_obj.GetUsers(ApplicationId);

            List<CascadingDropDownNameValue> user_list = new List<CascadingDropDownNameValue>();
            foreach (DataRow dRow in dt.Rows)
            {
                string UserId = dRow["UserId"].ToString();
                string UserName = dRow["UserName"].ToString();
                user_list.Add(new CascadingDropDownNameValue(UserName, UserId));
            }
            return user_list.ToArray();
        }
 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DropDownList ddlUserList = (DropDownList)e.Row.FindControl("ddlUserList");
         ddlUserList.Items.Clear();
         string ApplicationId = ddlApplicationList.SelectedValue;
         UserController user_obj = new UserController();
         DataTable dt_app = user_obj.GetUsers(ApplicationId);
         ddlUserList.DataSource = dt_app;
         ddlUserList.DataTextField = "UserName";
         ddlUserList.DataValueField = "UserId";
         ddlUserList.DataBind();
         ddlUserList.Items.Insert(0, new ListItem("- Chọn -", ""));
         ddlUserList.SelectedIndex = 0;
     }
 }