//method to select data on edit private void BindSelected(int intCapacitorSNo) { lblMessage.Text = ""; objCapacitor.BindDefectOnSNo(intCapacitorSNo, "SELECT_ON_DEFECT_SNO"); // Added by Gaurav Garg 21 OCT 09 for MTO ddlBusinessLine.SelectedIndex = ddlBusinessLine.Items.IndexOf(ddlBusinessLine.Items.FindByValue(objCapacitor.Businessline_Sno.ToString())); ddlBusinessLine_SelectIndexChanged(null, null); ddlProductDiv.SelectedIndex = ddlProductDiv.Items.IndexOf(ddlProductDiv.Items.FindByValue(objCapacitor.Unit_Sno.ToString())); ddlProductDiv_SelectedIndexChanged(null, null); ddlProductLine.SelectedIndex = ddlProductLine.Items.IndexOf(ddlProductLine.Items.FindByValue(objCapacitor.ProductLineSNo.ToString())); objServiceContractor.ProductLine_Sno = int.Parse(objCapacitor.ProductLineSNo.ToString()); objServiceContractor.BindDefectCatDdl(ddlDC); ddlDC.Items.Insert(0, new ListItem("Select", "0")); objServiceContractor.Defect_Category_SNo = Convert.ToInt32(objCapacitor.DefectCategorySNo.ToString()); objServiceContractor.BindDefectDdl(ddldefect); ddldefect.Items.Insert(0, new ListItem("Select", "0")); ddlDC.SelectedIndex = ddlDC.Items.IndexOf(ddlDC.Items.FindByValue(objCapacitor.DefectCategorySNo.ToString())); ddldefect.SelectedIndex = ddldefect.Items.IndexOf(ddldefect.Items.FindByValue(objCapacitor.DefectSNo.ToString())); txtCapacitor.Text = objCapacitor.CapacitorName; }
//method to select data on edit private void BindSelected(int intDefectSNo) { lblMessage.Text = ""; objCapacitor.BindDefectOnSNo(intDefectSNo, "SELECT_ON_DEFECT_SNO"); // Added by Gaurav Garg 21 OCT 09 for MTO ddlBusinessLine.SelectedIndex = ddlBusinessLine.Items.IndexOf(ddlBusinessLine.Items.FindByValue(objCapacitor.Businessline_Sno.ToString())); ddlBusinessLine_SelectIndexChanged(null, null); ddlProductDiv.SelectedIndex = ddlProductDiv.Items.IndexOf(ddlProductDiv.Items.FindByValue(objCapacitor.Unit_Sno.ToString())); ddlProductDiv_SelectedIndexChanged(null, null); ddlProductLine.SelectedIndex = ddlProductLine.Items.IndexOf(ddlProductLine.Items.FindByValue(objCapacitor.ProductLineSNo.ToString())); // END for (int intDCSNo = 0; intDCSNo <= ddlDC.Items.Count - 1; intDCSNo++) { if (ddlDC.Items[intDCSNo].Value == Convert.ToString(objCapacitor.DefectCategorySNo)) { ddlDC.SelectedIndex = intDCSNo; } } txtCapacitor.Text = objCapacitor.CapacitorName; // Code for selecting Status as in database for (intCnt = 0; intCnt < rdoStatus.Items.Count; intCnt++) { if (rdoStatus.Items[intCnt].Value.ToString().Trim() == objCapacitor.ActiveFlag.ToString().Trim()) { rdoStatus.Items[intCnt].Selected = true; } else { rdoStatus.Items[intCnt].Selected = false; } } }