public void FillDDL() { try { DataTable dt = BLL_Tec_ErLog.GET_ERLOGVERSIONS(int.Parse(lblLogId.Text), int.Parse(lblVesselId.Text)); DDLVersion.DataSource = dt; DDLVersion.DataTextField = "Version"; DDLVersion.DataValueField = "LOG_ID"; DDLVersion.DataBind(); ListItem li = new ListItem("--SELECT ALL--", "0"); DDLVersion.SelectedValue = lblLogId.Text; if (dt.Rows.Count == 1) { versionrowlbl.Visible = false; versionrow.Visible = false; lblVersion.Visible = false; DDLVersion.Visible = false; } //DataTable dtVessel = objVsl.Get_VesselList(0, 0, Convert.ToInt32(Session["USERCOMPANYID"].ToString()), "", Convert.ToInt32(Session["USERCOMPANYID"].ToString())); //DDLVessel.DataSource = dtVessel; //DDLVessel.DataTextField = "Vessel_name"; //DDLVessel.DataValueField = "Vessel_id"; //DDLVessel.DataBind(); //DDLVessel.Items.Insert(0, new ListItem("--SELECT ALL--", null)); } catch (Exception ex) { } finally { } }
public void BindDeckLogBookThrasholdList(int?Threshold_Id = null) { DataSet ds = BLL_OPS_DeckLog.Get_DeckLogBook_Thrashold_List(int.Parse(ViewState["VESSELID"].ToString()), UDFLib.ConvertIntegerToNull(lblLOGBOOKID.Value), Threshold_Id); ds.Tables[0].Rows[0]["Vessel_Id"] = UDFLib.ConvertIntegerToNull(ViewState["VESSELID"]); if (Threshold_Id == null) { DDLVersion.DataSource = ds.Tables[1]; DDLVersion.DataTextField = "Version"; DDLVersion.DataValueField = "ID"; DDLVersion.DataBind(); if (ds.Tables[1].Rows.Count == 0) { DDLVersion.Enabled = false; DDLVersion.Items.Insert(0, new ListItem("-No Records found-", "0")); } else { DDLVersion.Enabled = true; } } if (ds.Tables[0].Rows[0]["ID"].ToString() != "") { DDLVersion.SelectedValue = ds.Tables[0].Rows[0]["ID"].ToString(); } if (ds.Tables[0].Rows.Count > 0) { ddlVesselMain.SelectedValue = ds.Tables[0].Rows[0]["Vessel_Id"].ToString(); FormView1.DataSource = ds.Tables[0]; FormView1.DataBind(); if (ds.Tables[0].Rows[0]["Active_Status"].ToString() == "0") { //btnAddTo.Enabled = false; btnCopy.Enabled = false; // btnOK.Enabled = false; btnSave.Enabled = false; } else { //btnAddTo.Enabled = false; btnCopy.Enabled = true; // btnOK.Enabled = false; btnSave.Enabled = true; } } }
private void BindViews(int?Threshold_Id = null) { DataSet ds = BLL_Tec_ErLog.Get_ErLogBookThresHold_EDIT(int.Parse(ViewState["VESSELID"].ToString()), UDFLib.ConvertIntegerToNull(lblLogId.Text), Threshold_Id); ds.Tables[0].Rows[0]["Vessel_Id"] = UDFLib.ConvertIntegerToNull(ViewState["VESSELID"]); if (Threshold_Id == null) { DDLVersion.DataSource = ds.Tables[1]; DDLVersion.DataTextField = "Version"; DDLVersion.DataValueField = "ID"; DDLVersion.DataBind(); if (ds.Tables[1].Rows.Count == 0) { DDLVersion.Enabled = false; DDLVersion.Items.Insert(0, new ListItem("-No Records found-", "0")); } else { DDLVersion.Enabled = true; } } if (ds.Tables[0].Rows.Count > 0) { ddlVesselMain.SelectedValue = ds.Tables[0].Rows[0]["Vessel_Id"].ToString(); FormView1.DataSource = ds.Tables[0]; FormView1.DataBind(); if (ds.Tables[0].Rows[0]["Active_Status"].ToString() == "0") { btnAddTo.Enabled = false; btnCopy.Enabled = false; // btnOK.Enabled = false; btnSave.Enabled = false; } } if (Convert.ToString(ds.Tables[0].Rows[0]["ID"]) != "")//if ds doesn't have rows throwing an error { DDLVersion.SelectedValue = ds.Tables[0].Rows[0]["ID"].ToString(); } }