protected void BindGrid() { List <Disbursement> disList = new List <Disbursement>(); disList = disDAO.getAllAwaitingDisbursement(); List <AssignClerkGridView> list = new List <AssignClerkGridView>(); for (int i = 0; i < disList.Count(); i++) { list.Add(new AssignClerkGridView()); list[i].CollectionPointName = dDAO.getCollectionPointbyDepartmentId(disList[i].deptID); list[i].DeptID = disList[i].deptID; list[i].Status = disList[i].status; if (i > 0) { for (int j = 0; j < list.Count - 1; j++) { if (list[i].DeptID == list[j].DeptID) { list.RemoveAt(j); disList.RemoveAt(j); i--; } } } } List <CollectionPoint> collectionlist = collectionDAO.getAllCollectionPoint(); for (int i = 0; i < list.Count(); i++) { if (list[i].CollectionPointName.Contains(collectionlist[0].description)) { dropdownlist1.Enabled = true; dropdownlist1.BackColor = System.Drawing.Color.White; } if (list[i].CollectionPointName.Contains(collectionlist[1].description)) { dropdownlist2.Enabled = true; dropdownlist2.BackColor = System.Drawing.Color.White; } if (list[i].CollectionPointName.Contains(collectionlist[2].description)) { dropdownlist3.Enabled = true; dropdownlist3.BackColor = System.Drawing.Color.White; } if (list[i].CollectionPointName.Contains(collectionlist[3].description)) { dropdownlist4.Enabled = true; dropdownlist4.BackColor = System.Drawing.Color.White; } if (list[i].CollectionPointName.Contains(collectionlist[4].description)) { dropdownlist5.Enabled = true; dropdownlist5.BackColor = System.Drawing.Color.White; } if (list[i].CollectionPointName.Contains(collectionlist[5].description)) { dropdownlist6.Enabled = true; dropdownlist6.BackColor = System.Drawing.Color.White; } } GridView_AssignClerk.DataSource = list; GridView_AssignClerk.DataBind(); }