public void Initialize() { // Clear existing items lstAllUsers.Items.Clear(); lstSelectedUsers.Items.Clear(); // Get all users for All Users List Box lstAllUsers.DataSource = ITUser.GetAllUsers(); lstAllUsers.DataTextField = "DisplayName"; lstAllUsers.DataValueField = "Id"; lstAllUsers.DataBind(); // Copy selected users into Selected Users List Box ITUserCollection projectUsers = ITUser.GetUsersByProjectId(ProjectId); foreach (ITUser currentUser in projectUsers) { ListItem matchItem = lstAllUsers.Items.FindByValue(currentUser.Id.ToString()); if (matchItem != null) { lstSelectedUsers.Items.Add(matchItem); lstAllUsers.Items.Remove(matchItem); } } }
//********************************************************************* // // The BindProjects method retrieves the list of projects the current user // can view based on their role and then databinds them to the ProjectsGrid // //********************************************************************* private void BindUsers() { ITUserCollection userList = ITUser.GetAllUsers(); // Call method to sort the data before databinding SortGridData(userList, SortField, SortAscending); UsersGrid.DataSource = userList; UsersGrid.DataBind(); }
public void Initialize() { dropProjectManager.DataSource = ITUser.GetAllUsers(); dropProjectManager.DataBind(); if (ProjectId != -1) { Project projectToUpdate = Project.GetProjectById(ProjectId); if (projectToUpdate != null) { txtName.Text = projectToUpdate.Name; txtDescription.Text = projectToUpdate.Description; dropProjectManager.SelectedValue = projectToUpdate.ManagerId; dropProjectManager.RemoveDefault(); } } }