protected void ListViewUsers_ItemEditing(object sender, ListViewEditEventArgs e) { ListViewUsers.EditIndex = e.NewEditIndex; PopulateListViewUsers(); if (this.ListViewUsers.EditIndex != -1) { Panel validationMsg = (Panel)this.ListViewUsers.Items[this.ListViewUsers.EditIndex].FindControl("editNameContainerIsValid"); UpdatePanel updatePanel = (UpdatePanel)this.ListViewUsers.Items[this.ListViewUsers.EditIndex].FindControl("UpdatePanelEdit"); TextBox TextBoxUserNameEdit = (TextBox)updatePanel.FindControl("TextBoxUsernameEdit"); CheckBoxList CheckBoxListRolesOfUser = (CheckBoxList)updatePanel.FindControl("CheckBoxListRolesOfUser"); Literal ListeralApplicationName = (Literal)updatePanel.FindControl("LiteralAppNameEdit"); List <String> userRolesList = RolesBLL.GetRolesForUserByApplication(ListeralApplicationName.Text, TextBoxUserNameEdit.Text); List <String> applicationRolesList = RolesBLL.GetRolesByApplication(ListeralApplicationName.Text); validationMsg.Visible = false; foreach (string applicationRole in applicationRolesList) { System.Web.UI.WebControls.ListItem listItem = new System.Web.UI.WebControls.ListItem(applicationRole, "", true); foreach (string userRole in userRolesList) { if (applicationRole == userRole) { listItem.Selected = true; } } CheckBoxListRolesOfUser.Items.Add(listItem); } } }
protected void DropDownApplicationNewUser_SelectedIndexChanged(object sender, EventArgs e) { //string applicationName = this.DropDownApplicationNewUser.SelectedValue; string applicationName = this.DropDownApplicationNewUser.SelectedItem.Text; this.CheckBoxListApplicationRoles.DataSource = RolesBLL.GetRolesByApplication(applicationName); this.CheckBoxListApplicationRoles.DataBind(); }
protected void DropDownApplicationsDeleteRole_SelectedIndexChanged(object sender, EventArgs e) { string applicationName = this.DropDownApplicationsDeleteRole.SelectedValue; this.CheckBoxListApplicationRoles.DataSource = RolesBLL.GetRolesByApplication(applicationName); this.CheckBoxListApplicationRoles.DataBind(); //if (this.DropDownApplicationsDeleteRole.SelectedValue != "---Select Application---") //{ // this.CheckBoxListApplicationRoles.DataSourceID = "ObjectDataSourceApplicationRoles"; // this.ObjectDataSourceApplicationRoles.Select(); //} //else //{ // this.CheckBoxListApplicationRoles.DataSourceID = null; //} ////this.ObjectDataSourceApplicationRoles.Select(); }