/// <summary> /// Binds To and From Selects to show available and selected Contacts /// </summary> protected void BindContactsData() { ProjectManagementDa da = new ProjectManagementDa(); unassociatedContact = da.GetAllUnassignedContacts(projectId).DefaultView; associatedContacts = da.GetProjectContactsByProjectId(projectId).DefaultView; FromContactsOrgRptr.DataSource = da.GetProjectOrganizationsByProjectId(projectId).DefaultView; FromContactsOrgRptr.DataBind(); ToContactsOrgRptr.DataSource = da.GetProjectOrganizationsByProjectId(projectId).DefaultView; ToContactsOrgRptr.DataBind(); }
/// <summary> /// Handle building of contacts based on organization /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnFromOrganizationsBound(object sender, RepeaterItemEventArgs e) { Repeater singleContactsRptr = e.Item.FindControl("SingleContactsRptr") as Repeater; int orgId = int.Parse(DataBinder.Eval(e.Item.DataItem, ProjectOrganization.OrganizationId).ToString()); ProjectManagementDa da = new ProjectManagementDa(); DataView fromOrgContacts = da.GetAllUnassignedContacts(projectId).DefaultView; string filter = "OrganizationId = " + orgId; fromOrgContacts.RowFilter = filter; // If there were no records which filterd, hide item if (fromOrgContacts.Count == 0) { e.Item.Visible = false; } // else bind options to contacts else { singleContactsRptr.DataSource = fromOrgContacts; singleContactsRptr.DataBind(); } }