public void PopulateDropOutGrid() { if (!string.IsNullOrEmpty(Session["EditLabKitID"].ToString())) { // get drop out data for our lab kit DataTable dt = bi.GetDropOutData(Session["EditLabKitID"].ToString()); using (DataView dv = new DataView(dt)) { // create our filter string strRowFilter = ""; if (!String.IsNullOrEmpty(this.ddlNoOfPersons.SelectedValue)) { strRowFilter = "NoOfPersonsInvolvd = '" + this.ddlNoOfPersons.SelectedValue + "'"; } if (!String.IsNullOrEmpty(this.ddlDropOutType.SelectedValue)) { if (!String.IsNullOrEmpty(strRowFilter)) { strRowFilter += " and "; } strRowFilter += "typeID = '" + this.ddlDropOutType.SelectedValue + "'"; } if (!String.IsNullOrEmpty(this.ddlDeducible.SelectedValue)) { if (!String.IsNullOrEmpty(strRowFilter)) { strRowFilter += " and "; } strRowFilter += "Deducible = '" + this.ddlDeducible.SelectedValue + "'"; } if (!String.IsNullOrEmpty(this.ddlDropOutOption.SelectedValue)) { if (!String.IsNullOrEmpty(strRowFilter)) { strRowFilter += " and "; } strRowFilter += "dropOptionID = '" + this.ddlDropOutOption.SelectedValue + "'"; } if (!String.IsNullOrEmpty(this.ddlLocus.SelectedValue)) { if (!String.IsNullOrEmpty(strRowFilter)) { strRowFilter += " and "; } strRowFilter += "LocusID = '" + this.ddlLocus.SelectedValue + "'"; } // filter our data view if (!String.IsNullOrEmpty(strRowFilter)) { dv.RowFilter = strRowFilter; } // set source and display this.gvDropOut.DataSource = dv; this.gvDropOut.DataBind(); } } }