protected void WzInspection_DataBinding(object sender, EventArgs e) { GridView GvInspectionDetails = ((GridView) mvInspectionDetails.FindControl("GvInspectionDetails")); Guid InspectionId = (Guid) GvInspectionDetails.SelectedDataKey.Value; Inspection objInspection = new Inspection(); DataTable dtInspectionDetails = new DataTable(); //dtInspectionDetails = objInspection.GetAllInspectionDetailsById(InspectionId); txtInspectorOfficeNameUpd.Text = Convert.ToString(dtInspectionDetails.Columns["InspectorOfficeName"]); DataTable dtQueries = new DataTable(); dtQueries = objInspection.GetInspectionQueriesByInspectionId(InspectionId); GvInspectionQueriesUpd.DataSource = dtQueries; GvInspectionQueriesUpd.DataBind(); }
protected void WzInspectionUpd_DataBinding(object sender, EventArgs e) { if (fldSelectedKey.Value != "") { Guid InspectionId = new Guid(fldSelectedKey.Value); Inspection objInspection = new Inspection(); DataRow drInspectionDetails = objInspection.GetInspectionDetailsById(InspectionId).Rows[0]; //ddlInspectionTypeIdUpd.DataValueField = ((Guid) drInspectionDetails["InspectionTypeId"]).ToString(); // ddlInspectingOfficerIdUpd.DataValueField = ((Guid) drInspectionDetails["InspectingOfficerId"]).ToString(); //ddlInspectionTypeIdUpd.DataTextField = ((Guid) drInspectionDetails["InspectionTypeId"]).ToString(); //ddlInspectingOfficerIdUpd.DataTextField = ((Guid) drInspectionDetails["InspectingOfficerId"]).ToString(); //txtInspectorOfficeNameUpd.Text = ((Guid) drInspectionDetails["InspectorOfficeName"]).ToString(); txtInspectorOfficeNameUpd.Text = Convert.ToString(drInspectionDetails["InspectorOfficeName"]); IsdescripancyFoundUpd.Checked = (bool) (drInspectionDetails["IsDiscrepancyFound"]); txtInspectionRemarksUpd.Text = Convert.ToString(drInspectionDetails["Remarks"]); DataTable dtQueries = new DataTable(); dtQueries = objInspection.GetInspectionQueriesByInspectionId(InspectionId); GvInspectionQueriesUpd.DataSource = dtQueries; GvInspectionQueriesUpd.DataBind(); Wizard Container = (Wizard) Master.FindControl("Main").FindControl("WzInspectionUpd"); List<CheckListInspectionRow> CheckListRows = new List<CheckListInspectionRow>(); string filename = Server.MapPath("~\\Inspection\\InspectionCheckList.xml"); XmlDocument InspectionCheckListXml = new XmlDocument(); InspectionCheckListXml.Load(filename); foreach (XmlNode Node in InspectionCheckListXml.SelectNodes("DocumentElement/Items")) { CheckListInspectionTable dtChecklist = new CheckListInspectionTable(); dtChecklist = (CheckListInspectionTable) objInspection.GetInspectionCheckListById(InspectionId); CheckListInspectionRow drCheckListRow = Inspection.GetCheckListRow(); Guid[] keys = { InspectionId, new Guid(Node.Attributes["ItemId"].Value) }; drCheckListRow = (CheckListInspectionRow) dtChecklist.FindByInspectionIdInspectionCheckListId(keys[0], keys[1]); TextBox txtRemarks = (TextBox) Container.FindControl("txt" + Node.Attributes["ItemId"].Value); CheckBox chkYesNo = (CheckBox) Container.FindControl("chk" + Node.Attributes["ItemId"].Value); if (null != txtRemarks) { txtRemarks.Text = Convert.ToString(drCheckListRow["Remarks"]); } if (null != chkYesNo) { chkYesNo.Checked = (bool) drCheckListRow["Checked"]; } } } }