Beispiel #1
0
        public static void BuildDropdownlist(ref DropDownList pv_objCbo, DataTable pv_dtData, bool pv_blGenDefaultItem = false, string pv_strDefaultVal = "")
        {
            try
            {
                pv_objCbo.Items.Clear();

                if (pv_blGenDefaultItem)
                {
                    ListItem v_objRoot = new ListItem();
                    v_objRoot.Text  = LanguageEngine.Instance().GetContent(LanguageType.TypeUI, "U.DungChung.TatCa");
                    v_objRoot.Value = "ALL";
                    pv_objCbo.Items.Add(v_objRoot);
                }

                if (null != pv_dtData)
                {
                    for (int i = 0; i < pv_dtData.Rows.Count; i++)
                    {
                        ListItem v_objItem = new ListItem();
                        v_objItem.Text  = pv_dtData.Rows[i][2].ToString();
                        v_objItem.Value = pv_dtData.Rows[i][1].ToString();
                        pv_objCbo.Items.Add(v_objItem);
                    }

                    if (pv_strDefaultVal.Length > 0)
                    {
                        pv_objCbo.SelectedValue = pv_strDefaultVal;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        public static LanguageEngine Instance()
        {
            if (mv_strCurrentLanguage != AppConfig.Language)
            {
                mv_objCurrLanguage = new Business.LanguageEngine(AppConfig.Language);
            }

            if (null == mv_objCurrLanguage)
            {
                mv_objCurrLanguage = new Business.LanguageEngine(AppConfig.Language);
            }

            return(mv_objCurrLanguage);
        }