public void BindControl(Control cntrl, string fieldname) { DataTable thedeCodeDT = new DataTable(); IQCareUtils iQCareUtils = new IQCareUtils(); BindFunctions BindManager = new BindFunctions(); DataSet theDSXML = new DataSet(); theDSXML.ReadXml(MapPath("..\\XMLFiles\\AllMasters.con")); DataView theCodeDV = new DataView(theDSXML.Tables["MST_CODE"]); theCodeDV.RowFilter = "DeleteFlag=0 and Name='" + fieldname + "'"; DataTable theCodeDT = (DataTable)iQCareUtils.CreateTableFromDataView(theCodeDV); DataView theDV = new DataView(theDSXML.Tables["MST_DECODE"]); if (fieldname.ToString() != "") { if (theCodeDT.Rows.Count > 0) { theDV.RowFilter = "DeleteFlag=0 and SystemID IN(0," + Convert.ToString(Session["SystemId"]) + ") and CodeID=" + theCodeDT.Rows[0]["CodeId"]; theDV.Sort = "SRNo ASC"; thedeCodeDT = (DataTable)iQCareUtils.CreateTableFromDataView(theDV); } if (cntrl is CheckBoxList) { if (thedeCodeDT.Rows.Count > 0) { BindManager.BindCheckedList((CheckBoxList)cntrl, thedeCodeDT, "Name", "ID"); } } else if (cntrl is DropDownList) { if (thedeCodeDT.Rows.Count > 0) { BindManager.BindCombo((DropDownList)cntrl, thedeCodeDT, "Name", "ID"); } } else if (cntrl is RadioButtonList) { if (thedeCodeDT.Rows.Count > 0) { BindManager.RadioButtonList((RadioButtonList)cntrl, thedeCodeDT, "Name", "ID"); } } } else { theDV = new DataView(theDSXML.Tables["MST_DECODE"]); if (theDV.Table.Rows.Count > 0) { theDV.RowFilter = "DeleteFlag=0 and SystemID IN(0," + Convert.ToString(Session["SystemId"]) + ") and CodeID=17 and ModuleId=209"; theDV.Sort = "SRNo ASC"; thedeCodeDT = new DataTable(); thedeCodeDT = (DataTable)iQCareUtils.CreateTableFromDataView(theDV); } if (cntrl is CheckBoxList) { if (thedeCodeDT.Rows.Count > 0) { BindManager.BindCheckedList((CheckBoxList)cntrl, thedeCodeDT, "Name", "ID"); } } else if (cntrl is DropDownList) { if (thedeCodeDT.Rows.Count > 0) { BindManager.BindCombo((DropDownList)cntrl, thedeCodeDT, "Name", "ID"); } } else if (cntrl is RadioButtonList) { if (thedeCodeDT.Rows.Count > 0) { BindManager.RadioButtonList((RadioButtonList)cntrl, thedeCodeDT, "Name", "ID"); } } } }