Ejemplo n.º 1
0
 public static void SeleccionarItemCombo(ref DropDownList combo, string valor, string texto)
 {
     combo.ClearSelection();
     if ((combo.Items.FindByValue(valor) == null))
         combo.Items.Insert(0, new ListItem(texto, valor));
     combo.Items.FindByValue(valor).Selected = true;
 }
Ejemplo n.º 2
0
    protected void seleccionaValorDelCombo(DropDownList cbx, String valueToSet)
    {
        cbx.ClearSelection();
          ListItem li = cbx.Items.FindByValue(valueToSet);

          if (li != null)
          {
        li.Selected = true;
          }
    }
Ejemplo n.º 3
0
 public static void SelectDropDownValue(DropDownList ddl, string value)
 {
     if (value == "")
         return;
     ListItem li = ddl.Items.FindByValue(value);
     if (li != null)
     {
         ddl.ClearSelection();
         li.Selected = true;
     }
 }
	private void LoadParentDropDown(DropDownList ddl, Category self)
	{
		// Load up the Parent DropDown
		ddl.ClearSelection();
		ddl.Items.Add(new ListItem("none", "0"));
		foreach (Category cat in Category.Categories)
		{
            if (self == null || !cat.Id.Equals(self.Id))
			    ddl.Items.Add(new ListItem(cat.CompleteTitle(), cat.Id.ToString()));
		}
	}
Ejemplo n.º 5
0
        protected void MakeSafeListSelection(DropDownList listCtl, string valueSelected)
        {
            if (listCtl == null)
            {
                return;
            }
            //
            var li = listCtl.Items.FindByValue(valueSelected);

            //
            if (li == null)
            {
                return;
            }
            //
            listCtl.ClearSelection();
            li.Selected = true;
        }
Ejemplo n.º 6
0
    public void CargaDrop_patentes(object nombreDrop, string value, string text, DataTable dt, string[] atributos = null, string campo_marca = null, string valor_marca = null)
    {
        DropDownList drop = (DropDownList)nombreDrop;

        drop.DataSource    = null;
        drop.SelectedIndex = -1;
        drop.ClearSelection();
        drop.SelectedValue = null;
        drop.DataBind();
        drop.Items.Clear();
        ListItem li = new ListItem("Seleccione...", "0");

        drop.Items.Add(li);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            ListItem l2 = new ListItem();
            l2.Value = dt.Rows[i][value].ToString();
            l2.Text  = dt.Rows[i][text].ToString().ToUpper(); //+ " (" + dt.Rows[i][campo_marca].ToString().ToUpper() + ")";
            drop.Items.Add(l2);
            if (atributos != null)
            {
                for (int j = 0; j < atributos.Length; j++)
                {
                    l2.Attributes.Add(atributos[j], dt.Rows[i][atributos[j]].ToString());
                }
            }
            if (campo_marca != null)
            {
                if (dt.Rows[i][campo_marca].ToString() == valor_marca)
                {
                    l2.Attributes.Add("class", "marcado");
                }
            }
        }


        drop.SelectedIndex = 0;


        if (drop.Items.Count == 2)
        {
            drop.SelectedIndex = 1;
        }
    }
Ejemplo n.º 7
0
        protected void gvCustomUrls_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem && (e.Item.DataItem.GetType() != typeof(GridInsertionObject)))
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                TabUrlInfo   item     = (TabUrlInfo)dataItem.DataItem;

                DropDownList ddlPortalAliasId   = (DropDownList)dataItem.FindControl("ddlPortalAliasId");
                DropDownList ddlPortalAliasUage = (DropDownList)dataItem.FindControl("ddlPortalAliasUsage");
                DropDownList ddlHttpStatus      = (DropDownList)dataItem.FindControl("ddlHttpStatus");

                if (ddlPortalAliasId != null)
                {
                    ListItem liPortalAliasId = ddlPortalAliasId.Items.FindByValue(item.PortalAliasId.ToString());
                    if (liPortalAliasId != null)
                    {
                        ddlPortalAliasId.ClearSelection();
                        liPortalAliasId.Selected = true;
                    }
                }

                if (ddlPortalAliasUage != null)
                {
                    int portalAliasUage = (int)item.PortalAliasUsage;

                    ListItem liPortalAliasUage = ddlPortalAliasUage.Items.FindByValue(portalAliasUage.ToString());
                    if (liPortalAliasUage != null)
                    {
                        ddlPortalAliasUage.ClearSelection();
                        liPortalAliasUage.Selected = true;
                    }
                }

                if (ddlHttpStatus != null)
                {
                    ListItem liHttpStatus = ddlHttpStatus.Items.FindByValue(item.HttpStatus);
                    if (liHttpStatus != null)
                    {
                        ddlHttpStatus.ClearSelection();
                        liHttpStatus.Selected = true;
                    }
                }
            }
        }
Ejemplo n.º 8
0
    private void SetPreviousData()
    {
        int rowIndex = 0;

        if (ViewState["CurrentTable"] != null)
        {
            DataTable dt = (DataTable)ViewState["CurrentTable"];
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //Set the Previous Selected Items on Each DropDownList on Postbacks
                    TextBox txtArt = (TextBox)GridViewpo.Rows[rowIndex].Cells[0].FindControl("txtArt");
                    TextBox txtQty = (TextBox)GridViewpo.Rows[rowIndex].Cells[1].FindControl("txtQty");
                    //TextBox txtprc = (TextBox)GridViewpo.Rows[rowIndex].Cells[2].FindControl("txtprc");
                    //TextBox txtspdt = (TextBox)GridViewpo.Rows[rowIndex].Cells[3].FindControl("txtspdt");
                    //TextBox txtexft = (TextBox)GridViewpo.Rows[rowIndex].Cells[4].FindControl("txtexft");
                    //TextBox txtld = (TextBox)GridViewpo.Rows[rowIndex].Cells[5].FindControl("txtld");
                    //TextBox txtbss = (TextBox)GridViewpo.Rows[rowIndex].Cells[6].FindControl("txtbss");
                    DropDownList ddlItem = (DropDownList)GridViewpo.Rows[rowIndex].Cells[2].FindControl("ddlItem");
                    //For Smv
                    TextBox txtSmv = (TextBox)GridViewpo.Rows[rowIndex].Cells[3].FindControl("txtSmv");
                    //Fill the DropDownList with Data
                    // FillDropDownList(ddl3);

                    if (i < dt.Rows.Count - 1)
                    {
                        txtArt.Text = dt.Rows[i]["Column0"].ToString();
                        txtQty.Text = dt.Rows[i]["Column1"].ToString();
                        //txtprc.Text = dt.Rows[i]["Column2"].ToString();
                        //txtspdt.Text = dt.Rows[i]["Column3"].ToString();
                        //txtexft.Text = dt.Rows[i]["Column4"].ToString();
                        //txtld.Text = dt.Rows[i]["Column5"].ToString();
                        //txtbss.Text = dt.Rows[i]["Column6"].ToString();
                        ddlItem.ClearSelection();
                        ddlItem.Items.FindByText(dt.Rows[i]["Column2"].ToString()).Selected = true;
                        //For Smv
                        txtSmv.Text = dt.Rows[i]["Column3"].ToString();
                    }
                    rowIndex++;
                }
            }
        }
    }
Ejemplo n.º 9
0
        /// <Summary>RenderEditMode renders the Edit mode of the control</Summary>
        /// <Param name="writer">A HtmlTextWriter.</Param>
        protected override void RenderEditMode(HtmlTextWriter writer)
        {
            //For convenience create a DropDownList to use
            DropDownList cboLocale = new DropDownList();

            //Load the List with Locales
            Localization.LoadCultureDropDownList(cboLocale, CultureDropDownTypes.NativeName, ((PageBase)Page).PageCulture.Name);

            //Select the relevant item
            if (cboLocale.Items.FindByValue(StringValue) != null)
            {
                cboLocale.ClearSelection();
                cboLocale.Items.FindByValue(StringValue).Selected = true;
            }

            //Render the Select Tag
            ControlStyle.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
            writer.RenderBeginTag(HtmlTextWriterTag.Select);

            for (int I = 0; I <= cboLocale.Items.Count - 1; I++)
            {
                string localeValue = cboLocale.Items[I].Value;
                string localeName  = cboLocale.Items[I].Text;
                bool   isSelected  = cboLocale.Items[I].Selected;

                //Add the Value Attribute
                writer.AddAttribute(HtmlTextWriterAttribute.Value, localeValue);

                if (isSelected)
                {
                    //Add the Selected Attribute
                    writer.AddAttribute(HtmlTextWriterAttribute.Selected, "selected");
                }

                //Render Option Tag
                writer.RenderBeginTag(HtmlTextWriterTag.Option);
                writer.Write(localeName);
                writer.RenderEndTag();
            }

            //Close Select Tag
            writer.RenderEndTag();
        }
Ejemplo n.º 10
0
    protected void grClients_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DataRowView drv = e.Row.DataItem as DataRowView;
            //DropDownList ddlGVTeam = (e.Row.FindControl("ddlGVTeam") as DropDownList);
            DropDownList ddlGVPlatform = (e.Row.FindControl("ddlGVPlatform") as DropDownList);

            //dt = new DataTable();
            //dt = objReal.LoadTeams(Session["access"].ToString(), Session["Location"].ToString(), Session["username"].ToString(), Session["team"].ToString(), Session["UID"].ToString());
            //if (dt.Rows.Count > 0)
            //{
            //    ddlGVTeam.DataSource = dt;
            //    ddlGVTeam.DataTextField = "T_TeamName";
            //    ddlGVTeam.DataValueField = "T_ID";
            //    ddlGVTeam.DataBind();
            //}

            string platform = drv["platform"].ToString();

            dt = new DataTable();
            dt = objAccount.LoadCorePlatform();
            if (dt.Rows.Count > 0)
            {
                ddlGVPlatform.DataSource     = dt;
                ddlGVPlatform.DataTextField  = "CL_Product";
                ddlGVPlatform.DataValueField = "CL_Product";
                ddlGVPlatform.DataBind();

                ddlGVPlatform.Items.Insert(0, "--Select Platform--");
                ddlGVPlatform.SelectedIndex = 0;

                if (!string.IsNullOrWhiteSpace(platform))
                {
                    if (ddlGVPlatform.Items.FindByValue(platform) != null)
                    {
                        ddlGVPlatform.ClearSelection();
                        ddlGVPlatform.Items.FindByText(platform).Selected = true;
                    }
                }
            }
        }
    }
Ejemplo n.º 11
0
 public void ddlTecnicaAnalisis(DropDownList ddl)
 {
     ddl.ClearSelection();
     ddl.Items.Clear();
     ddl.AppendDataBoundItems = true;
     ddl.Items.Add("<< Elija Tecnica >>");
     ddl.Items[0].Value = "0";
     ddl.Items.Add("No aplica");
     ddl.Items[1].Value = "No aplica";
     ddl.Items.Add("5 porque");
     ddl.Items[2].Value = "5 porque";
     ddl.Items.Add("Pareto");
     ddl.Items[3].Value = "Pareto";
     ddl.Items.Add("Causa Efecto");
     ddl.Items[4].Value = "Causa Efecto";
     ddl.Items.Add("Otra");
     ddl.Items[5].Value = "Otra";
     ddl.DataBind();
 }
Ejemplo n.º 12
0
        private void BindMonths()
        {
            string currentValue = _monthDropDownList.SelectedValue;

            _monthDropDownList.Items.Clear();
            _monthDropDownList.SelectedIndex = -1;
            _monthDropDownList.SelectedValue = null;
            _monthDropDownList.ClearSelection();

            _monthDropDownList.Items.Add(new ListItem(string.Empty, string.Empty));
            DateTime date = new DateTime(2000, 1, 1);

            for (int i = 0; i <= 11; i++)
            {
                _monthDropDownList.Items.Add(new ListItem(date.AddMonths(i).ToString("MMM"), (i + 1).ToString()));
            }

            _monthDropDownList.SetValue(currentValue);
        }
Ejemplo n.º 13
0
    protected void ddAccGroup_DataBound(object sender, EventArgs e)
    {
        try
        {
            DropDownList ddl = (DropDownList)sender;

            ddl.ClearSelection();

            ListItem li = ddl.Items.FindByText("Bank Accounts");
            if (li != null)
            {
                li.Selected = true;
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Ejemplo n.º 14
0
        /// <summary>
        /// Handles the DataBound event of the DropDownListDestinationProperty control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected void DropDownListDestinationProperty_DataBound(object sender, EventArgs e)
        {
            DropDownList dropDownListDestinationProperty = (DropDownList)sender;
            FormView     formView = (FormView)dropDownListDestinationProperty.NamingContainer;

            if (formView.DataItem != null)
            {
                string destinationProperty =
                    ((BusinessObjects.Mapping)formView.DataItem).MappingPropertyAssociation.DestinationProperty;

                dropDownListDestinationProperty.ClearSelection();

                ListItem listItem = dropDownListDestinationProperty.Items.FindByText(destinationProperty);
                if (listItem != null)
                {
                    listItem.Selected = true;
                }
            }
        }
Ejemplo n.º 15
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            int wiersze = GridView1.Rows.Count;


            for (int i = 0; i < wiersze; i++)
            {
                DropDownList ddl1 = (DropDownList)GridView1.Rows[i].Cells[0].FindControl("DropDownList4");
                TextBox      txt1 = (TextBox)GridView1.Rows[i].Cells[1].FindControl("TextBox1");

                string ocena     = ddl1.SelectedValue.ToString();
                string komentarz = txt1.Text;
                string idlekcja  = GridView1.Rows[i].Cells[6].Text;

                if (ocena != "0")
                {
                    using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString))
                    {
                        string     polecenie = "INSERT INTO OCENA (ID_Lekcja, Ocena, Komentarz) VALUES (@idlekcja, @ocena, @komentarz)";
                        SqlCommand cmd       = new SqlCommand(polecenie, con);
                        cmd.Parameters.AddWithValue("@idlekcja", idlekcja);
                        cmd.Parameters.AddWithValue("@ocena", ocena);
                        cmd.Parameters.AddWithValue("@komentarz", komentarz);
                        con.Open();
                        int wynik = cmd.ExecuteNonQuery();
                        con.Close();
                        if (wynik != 0)
                        {
                            Label5.Text    = "* Dodano poprawnie";
                            Label5.Visible = true;

                            ddl1.ClearSelection();
                            txt1.Text = "";
                        }
                        else
                        {
                            Label5.Text    = "* Błąd";
                            Label5.Visible = true;
                        }
                    }
                }
            }
        }
Ejemplo n.º 16
0
        private void SetPreviousData()
        {
            int rowIndex = 0;

            if (ViewState["Saleitems"] != null)
            {
                DataTable dt = (DataTable)ViewState["Saleitems"];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        TextBox box1 = (TextBox)Gridview1.Rows[i].Cells[1].FindControl("txtQuantity");

                        DropDownList ddl1 = (DropDownList)Gridview1.Rows[rowIndex].Cells[0].FindControl("ddlItemCode");

                        //Fill the DropDownList with Data
                        FillDropDownList(ddl1);

                        if (i < dt.Rows.Count - 1)
                        {
                            //Assign the value from DataTable to the TextBox
                            box1.Text = dt.Rows[i]["Quantity"].ToString();

                            //Set the Previous Selected Items on Each DropDownList  on Postbacks
                            ddl1.ClearSelection();
                            if (dt.Rows[i]["ItemCode"] != null)
                            {
                                try
                                {
                                    ddl1.Items.FindByText(dt.Rows[i]["ItemCode"].ToString()).Selected = true;
                                }
                                catch
                                {
                                }
                            }
                        }

                        rowIndex++;
                    }
                }
            }
        }
Ejemplo n.º 17
0
        public void dropIndSatisfaccion(DropDownList ddl) //OK
        {
            DataTable tabla = new DataTable();

            conectar.AbrirConexion();
            string           query    = "select * from sgc_indicador_satisfaccion;";
            MySqlDataAdapter consulta = new MySqlDataAdapter(query, conectar.conectar);

            consulta.Fill(tabla);
            conectar.CerrarConexion();
            ddl.ClearSelection();
            ddl.Items.Clear();
            ddl.AppendDataBoundItems = true;
            ddl.Items.Add("<< Elija Indicador de Satisfacción >>");
            ddl.Items[0].Value = "0";
            ddl.DataSource     = tabla;
            ddl.DataTextField  = "ind_satisfaccion";
            ddl.DataValueField = "id_ind_satisfaccion";
            ddl.DataBind();
        }
Ejemplo n.º 18
0
    /// <summary>
    /// 평가기간
    /// </summary>
    /// <param name="ddl"></param>
    public static void BindEstTerm(DropDownList ddl)
    {
        TermInfos term = new TermInfos();
        DataSet   ds   = term.GetAllList();

        ddl.DataSource     = ds;
        ddl.DataTextField  = "ESTTERM_NAME";
        ddl.DataValueField = "ESTTERM_REF_ID";
        ddl.DataBind();

        // 배포되어있는 평가월의 평가기간을 가져온다
        Biz_Bsc_Term_Detail objTD = new Biz_Bsc_Term_Detail();

        ddl.ClearSelection();

        if (ddl.Items.FindByValue(objTD.GetOpenEstTermID().ToString()) != null)
        {
            ddl.Items.FindByValue(objTD.GetOpenEstTermID().ToString()).Selected = true;
        }
    }
Ejemplo n.º 19
0
    public void BindddlChallan(DropDownList ddl, String strASC_ID, String strProcuctDivision)
    {
        DataSet ds = new DataSet();

        SqlParameter[] sqlParamS =
        {
            new SqlParameter("@ASCId",           strASC_ID),
            new SqlParameter("@ProductDivision", strProcuctDivision),
            new SqlParameter("@Type",            "BIND_GENERATED_CHALLANS")
        };
        ds                 = objsql.ExecuteDataset(CommandType.StoredProcedure, "uspDefectiveSpareChallan", sqlParamS);
        ddl.DataSource     = ds;
        ddl.DataTextField  = "challan_no";
        ddl.DataValueField = "challan_no";
        ddl.DataBind();
        ddl.Items.Insert(0, new ListItem("Select", "0"));
        ddl.ClearSelection();
        ds        = null;
        sqlParamS = null;
    }
Ejemplo n.º 20
0
    private void SelectItem(DropDownList ddlControl, string value)
    {
        ListItem lItem = ddlControl.Items.FindByValue(value) as ListItem;

        if (lItem != null)
        {
            ddlControl.SelectedValue = value.Trim();
            for (int i = 0; i <= ddlControl.Items.Count - 1; i++)
            {
                if (ddlControl.Items[i].Value.Trim() == value.Trim())
                {
                    ddlControl.Items[i].Selected = true;
                }
            }
        }
        else
        {
            ddlControl.ClearSelection();
        }
    }
Ejemplo n.º 21
0
        public void dropUnidad(DropDownList ddl) //OK
        {
            DataTable tabla = new DataTable();

            conectar.AbrirConexion();
            string           query    = "select id_unidad,Unidad from sgc_unidad where id_unidad = id_padre;";
            MySqlDataAdapter consulta = new MySqlDataAdapter(query, conectar.conectar);

            consulta.Fill(tabla);
            conectar.CerrarConexion();
            ddl.ClearSelection();
            ddl.Items.Clear();
            ddl.AppendDataBoundItems = true;
            ddl.Items.Add("<< Elija Unidad >>");
            ddl.Items[0].Value = "0";
            ddl.DataSource     = tabla;
            ddl.DataTextField  = "Unidad";
            ddl.DataValueField = "id_unidad";
            ddl.DataBind();
        }
Ejemplo n.º 22
0
        public void dropOpcionIngreso(DropDownList ddl) //OK
        {
            DataTable tabla = new DataTable();

            conectar.AbrirConexion();
            string           query    = "SELECT * FROM sgc_tipo_solicitud;";
            MySqlDataAdapter consulta = new MySqlDataAdapter(query, conectar.conectar);

            consulta.Fill(tabla);
            conectar.CerrarConexion();
            ddl.ClearSelection();
            ddl.Items.Clear();
            ddl.AppendDataBoundItems = true;
            ddl.Items.Add("<< Elija Proceso >>");
            ddl.Items[0].Value = "0";
            ddl.DataSource     = tabla;
            ddl.DataTextField  = "descripcion";
            ddl.DataValueField = "id_tipo";
            ddl.DataBind();
        }
Ejemplo n.º 23
0
        public void dropFadn(DropDownList ddl) //OK
        {
            DataTable tabla = new DataTable();

            conectar.AbrirConexion();
            string           query    = "SELECT * FROM sgc_fadn;";
            MySqlDataAdapter consulta = new MySqlDataAdapter(query, conectar.conectar);

            consulta.Fill(tabla);
            conectar.CerrarConexion();
            ddl.ClearSelection();
            ddl.Items.Clear();
            ddl.AppendDataBoundItems = true;
            ddl.Items.Add("<< Elija FADN >>");
            ddl.Items[0].Value = "0";
            ddl.DataSource     = tabla;
            ddl.DataTextField  = "fadn";
            ddl.DataValueField = "id_fadn";
            ddl.DataBind();
        }
Ejemplo n.º 24
0
        public void dropPeriodoM(DropDownList ddl) //OK
        {
            DataTable tabla = new DataTable();

            conectar.AbrirConexion();
            string           query    = "select * from sgc_periodo;";
            MySqlDataAdapter consulta = new MySqlDataAdapter(query, conectar.conectar);

            consulta.Fill(tabla);
            conectar.CerrarConexion();
            ddl.ClearSelection();
            ddl.Items.Clear();
            ddl.AppendDataBoundItems = true;
            ddl.Items.Add("<< Elija Período >>");
            ddl.Items[0].Value = "0";
            ddl.DataSource     = tabla;
            ddl.DataTextField  = "periodo";
            ddl.DataValueField = "id_periodo";
            ddl.DataBind();
        }
Ejemplo n.º 25
0
        /// <Summary>
        /// RenderViewMode renders the View (readonly) mode of the control
        /// </Summary>
        /// <Param name="writer">A HtmlTextWriter.</Param>
        protected override void RenderViewMode(HtmlTextWriter writer)
        {
            //For convenience create a DropDownList to use
            DropDownList cboLocale = new DropDownList();

            //Load the List with Locales
            Localization.LoadCultureDropDownList(cboLocale, CultureDropDownTypes.NativeName, ((PageBase)Page).PageCulture.Name);

            //Select the relevant item
            if (cboLocale.Items.FindByValue(StringValue) != null)
            {
                cboLocale.ClearSelection();
                cboLocale.Items.FindByValue(StringValue).Selected = true;
            }

            ControlStyle.AddAttributesToRender(writer);
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(cboLocale.SelectedItem.Text);
            writer.RenderEndTag();
        }
Ejemplo n.º 26
0
        private void PopulateSelectList(ref DropDownList ddlControl, int parameterId)
        {
            ILabManager labMgr = (ILabManager)ObjectFactory.CreateInstance("BusinessProcess.Laboratory.BLabManager, BusinessProcess.Laboratory");

            List <ParameterResultOption> options = labMgr.GetParameterResultOption(parameterId);

            if (options != null)
            {
                options.OrderBy(o => o.Text);
                ddlControl.Items.Clear();
                ddlControl.ClearSelection();
                ddlControl.Items.Add(new ListItem("Select...", "-1"));

                foreach (ParameterResultOption option in options)
                {
                    ListItem item = (new ListItem(option.Text, option.Id.ToString()));
                    ddlControl.Items.Add(item);
                }
            }
        }
Ejemplo n.º 27
0
        private void SetStatusSelectedValue(DropDownList ddlStatus, string strValue)
        {
            ddlStatus.ClearSelection();

            ListItem objListItem = ddlStatus.Items.FindByValue(strValue);

            if (objListItem != null)
            {
                //if (objListItem.Value == Convert.ToByte(JGConstant.TaskStatus.SpecsInProgress).ToString())
                //{
                //    ddlStatus.Enabled = false;
                //}
                //else
                //{
                ddlStatus.Enabled = true;
                // }
                objListItem.Enabled  = true;
                objListItem.Selected = true;
            }
        }
Ejemplo n.º 28
0
        public void dllEmpleado(DropDownList ddl, int unidad) //OK
        {
            DataTable tabla = new DataTable();

            conectar.AbrirConexion();
            string           query    = string.Format("select id_empleado,nombre from sgc_empleados where id_unidad = {0};", unidad);
            MySqlDataAdapter consulta = new MySqlDataAdapter(query, conectar.conectar);

            consulta.Fill(tabla);
            conectar.CerrarConexion();
            ddl.ClearSelection();
            ddl.Items.Clear();
            ddl.AppendDataBoundItems = true;
            ddl.Items.Add("<< Elija Empleado >>");
            ddl.Items[0].Value = "0";
            ddl.DataSource     = tabla;
            ddl.DataTextField  = "nombre";
            ddl.DataValueField = "id_empleado";
            ddl.DataBind();
        }
        private static DropDownList CreateDropDownQuestion(
            mojoProfilePropertyDefinition propertyDefinition,
            String propertyValue)
        {
            DropDownList dd = new DropDownList();

            if (dd.Items.Count == 0)
            {
                foreach (mojoProfilePropertyOption option in propertyDefinition.OptionList)
                {
                    ListItem listItem = new ListItem();
                    listItem.Value = option.Value;
                    listItem.Text  = option.TextResourceKey;
                    if (option.TextResourceKey.Length > 0)
                    {
                        if (HttpContext.Current != null)
                        {
                            Object obj = HttpContext.GetGlobalResourceObject(
                                propertyDefinition.ResourceFile, option.TextResourceKey);

                            if (obj != null)
                            {
                                listItem.Text = obj.ToString();
                            }
                        }
                    }

                    dd.Items.Add(listItem);
                }
            }

            ListItem defaultItem = dd.Items.FindByValue(propertyValue);

            if (defaultItem != null)
            {
                dd.ClearSelection();
                defaultItem.Selected = true;
            }

            return(dd);
        }
Ejemplo n.º 30
0
        private void PopulateUnits(ref DropDownList ddlControl, ref TextBox textLimit, int parameterid)
        {
            ILabManager labMgr = (ILabManager)ObjectFactory.CreateInstance("BusinessProcess.Laboratory.BLabManager, BusinessProcess.Laboratory");
            List <ParameterResultConfig> config = labMgr.GetParameterConfig(parameterid);

            if (config != null)
            {
                ddlControl.Items.Clear();
                ddlControl.ClearSelection();
                if (config.Count > 1)
                {
                    ddlControl.Items.Add(new ListItem("Select...", "-1"));
                }
                string strDefaultId = "";
                foreach (ParameterResultConfig row in config)
                {
                    ListItem item = (new ListItem(row.UnitName, row.UnitId.ToString()));
                    if (Convert.ToBoolean(row.IsDefault))
                    {
                        strDefaultId = row.UnitId.ToString();
                    }
                    item.Attributes.Add("is_default", row.IsDefault.ToString().ToLower());
                    item.Attributes.Add("min", row.MinBoundary.ToString());
                    item.Attributes.Add("max", row.MaxBoundary.ToString());
                    item.Attributes.Add("min_normal", row.MinNormalRange.ToString());
                    item.Attributes.Add("max_normal", row.MaxNormalRange.ToString());
                    item.Attributes.Add("detection_limit", row.DetectionLimit.ToString());
                    item.Attributes.Add("config_id", row.Id.ToString());
                    ddlControl.Items.Add(item);
                }
                if (strDefaultId != "")
                {
                    ListItem item = ddlControl.Items.FindByValue(strDefaultId);//.FindByValue(strDefaultId);
                    if (null != item)
                    {
                        item.Selected  = true;
                        textLimit.Text = item.Attributes["detection_limit"];
                    }
                }
            }
        }
Ejemplo n.º 31
0
        protected void tab_Clear_main_Click(object sender, CommandEventArgs e)
        {
            int i = Convert.ToInt32(e.CommandArgument);

            TroposInput ReceivedQty = (TroposInput)grdGOODSIN.Rows[i].Cells[6].FindControl("iRECEIVEDQTY");

            ReceivedQty.Text = string.Empty;
            DropDownList UOM = (DropDownList)grdGOODSIN.Rows[i].Cells[7].FindControl("iUOM");

            UOM.ClearSelection();
            TroposInput AdviceNote = (TroposInput)grdGOODSIN.Rows[i].Cells[8].FindControl("iADVICENOTE");

            AdviceNote.Text = string.Empty;
            TroposBusinessCalendar ReceivedDate = (TroposBusinessCalendar)grdGOODSIN.Rows[i].Cells[10].FindControl("tbcRECEIVEDDATE");

            ReceivedDate.Text = DateTime.Today.ToShortDateString();

            ReceivedQty.HighlightError = false;
            AdviceNote.HighlightError  = false;
            ShowMessage(string.Empty);
        }
Ejemplo n.º 32
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderViewMode renders the View (readonly) mode of the control
        /// </summary>
        /// <param name="writer">A HtmlTextWriter.</param>
        /// <history>
        ///     [cnurse]	05/02/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void RenderViewMode(HtmlTextWriter writer)
        {
            PortalSettings _portalSettings = Globals.GetPortalSettings();

            //For convenience create a DropDownList to use
            var cboTimeZones = new DropDownList();

            //Load the List with Time Zones
            Localization.LoadTimeZoneDropDownList(cboTimeZones, ((PageBase)Page).PageCulture.Name, Convert.ToString(_portalSettings.TimeZoneOffset));

            //Select the relevant item
            if (cboTimeZones.Items.FindByValue(StringValue) != null)
            {
                cboTimeZones.ClearSelection();
                cboTimeZones.Items.FindByValue(StringValue).Selected = true;
            }
            ControlStyle.AddAttributesToRender(writer);
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(cboTimeZones.SelectedItem.Text);
            writer.RenderEndTag();
        }
Ejemplo n.º 33
0
 public static void SetDdlSelectedValue(DropDownList ddl, string valueToselect)
 {
     try
     {
         if (ddl.Items.Count > 0)
         {
             ddl.ClearSelection();
             if (string.IsNullOrEmpty(valueToselect) == false)
             {
                 ddl.Items.FindByValue(valueToselect).Selected = true;
             }
             else
             {
                 ddl.SelectedIndex = 0;
             }
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 34
0
 public void CargaDropNormal(object nombreDrop, string value, string text, DataTable dt)
 {
     if (nombreDrop.GetType() == typeof(DropDownList))
     {
         DropDownList drop = (DropDownList)nombreDrop;
         drop.DataSource     = dt;
         drop.DataValueField = value;
         drop.DataTextField  = text;
         drop.DataBind();
         drop.ClearSelection();
     }
     if (nombreDrop.GetType() == typeof(RadComboBox))
     {
         RadComboBox drop = (RadComboBox)nombreDrop;
         drop.DataSource     = dt;
         drop.DataValueField = value;
         drop.DataTextField  = text;
         drop.DataBind();
         drop.ClearSelection();
     }
 }
Ejemplo n.º 35
0
 private void LoadParentDropDown(DropDownList ddl)
 {
     // Load up the Parent DropDown
     ddl.ClearSelection();
     ddl.Items.Add(new ListItem("none", "0"));
     foreach (Category cat in Category.Categories)
     {
         ddl.Items.Add(new ListItem(cat.CompleteTitle(), cat.Id.ToString()));
     }
 }
Ejemplo n.º 36
0
 private void DropDownList_SelectedValue(ref DropDownList ddl, string value)
 {
     ddl.ClearSelection();
     ListItem li = ddl.Items.FindByValue(value);
     if (li != null) li.Selected = true;
 }
 private void setLocationFromFacebookLocation(DropDownList ddl, string loc_name)
 {
     ddl.ClearSelection();
     foreach (ListItem item in ddl.Items)
     {
         if(item.Text.Equals(loc_name)){
             item.Selected = true;
             break;
         }
     }
 }