Пример #1
0
    public void BindVesselDDL()
    {
        try
        {
            StringBuilder sbFilterFlt = new StringBuilder();
            string        VslFilter   = "";
            foreach (DataRow dr in DDLFleet.SelectedValues.Rows)
            {
                sbFilterFlt.Append(dr[0]);
                sbFilterFlt.Append(",");
            }


            DataTable dtVessel = BLL_LMS_Training.Get_VesselList(0, 0, 0, Convert.ToInt32(Session["USERCOMPANYID"]), "", Convert.ToInt32(Session["USERCOMPANYID"]));

            if (sbFilterFlt.Length > 1)
            {
                sbFilterFlt.Remove(sbFilterFlt.Length - 1, 1);
                VslFilter = string.Format("fleetCode in (" + sbFilterFlt.ToString() + ")");
                dtVessel.DefaultView.RowFilter = VslFilter;
            }

            DDLVessel.DataSource     = dtVessel;
            DDLVessel.DataTextField  = "Vessel_name";
            DDLVessel.DataValueField = "Vessel_id";
            DDLVessel.DataBind();
        }
        catch (Exception ex)
        {
        }
    }
Пример #2
0
    protected void Bind_Vessel_List()
    {
        DataTable dtVessel = BLL_LMS_Training.Get_VesselList(Convert.ToInt32(ViewState["Program_Id"]), 0, 0, Convert.ToInt32(Session["USERCOMPANYID"]), "", Convert.ToInt32(Session["USERCOMPANYID"]));

        Dictionary <string, bool> VesselSelectedStates = new Dictionary <string, bool>();

        foreach (DataRow row in dtVessel.Rows)
        {
            VesselSelectedStates[row["Vessel_ID"].ToString()] = Convert.ToBoolean(row["Selected"]);
        }
        ViewState["VesselSelectedStates"] = VesselSelectedStates;

        chkLstSelectVessel.DataSource = dtVessel;
        chkLstSelectVessel.DataBind();
        chkLstSelectVessel.Items.Insert(0, new ListItem("SELECT ALL", null));

        string js = "LoadAfterCheckBox();";

        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert2", js, true);
    }