private void BindCandidatesGrid() { if (CachedCandidates == null) { string searchString = ""; if (txtMinimumExp.Text != "") { searchString += "YearsExperience='" + txtMinimumExp.Text + "'"; } if (txtTherapicExp.Text != "") { searchString += (searchString == "" ? "" : " OR ") + "TherapeuticExperience='" + txtTherapicExp.Text + "'"; } if (ddlFieldExp.SelectedIndex != 0) { searchString += (searchString == "" ? "" : " OR ") + "FieldTypeExperience='" + ddlFieldExp.SelectedValue + "'"; } CandidatesService objCandidatesService = new CandidatesService(); if (searchString != "") { TList <Candidates> objCandidatesList = objCandidatesService.Find(searchString); DataSet ds = objCandidatesList.ToDataSet(false); ds.Tables[0].Columns.Add(new DataColumn("Selected", System.Type.GetType("System.Boolean"))); ds.Tables[0].PrimaryKey = new DataColumn[] { ds.Tables[0].Columns["CandidateID"] }; CachedCandidates = ds;//caching data becuase we want to track candidates user select GVCandidates.DataSource = ds; GVCandidates.DataBind(); } else { GVCandidates.DataBind(); } } else { GVCandidates.DataSource = CachedCandidates; GVCandidates.DataBind(); } }