Exemple #1
0
        public void HienThiDropType()
        {
            DataTable dt = dalType.LayStypeVN();

            if (dt.Rows.Count > 0)
            {
                string ngonngu = Session["languege"].ToString();
                if (ngonngu == "lbl_VN")
                {
                    DropDown.DataSource     = dt;
                    DropDown.DataValueField = "Sitemtp";
                    DropDown.DataTextField  = "Stpnamevn";
                    DropDown.DataBind();
                }
                else if (ngonngu == "lbl_TW")
                {
                    DropDown.DataSource     = dt;
                    DropDown.DataValueField = "Sitemtp";
                    DropDown.DataTextField  = "Stpnamech";
                    DropDown.DataBind();
                }
                else if (ngonngu == "lbl_EN")
                {
                    DropDown.DataSource     = dt;
                    DropDown.DataValueField = "Sitemtp";
                    DropDown.DataTextField  = "Stpnameen";
                    DropDown.DataBind();
                }
                lblPercent.Text = dt.Rows[0]["StpPerCent"].ToString() + "%";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string        selectDrop = "SELECT CategoryName FROM Categories";
            DataSet       drop       = new DataSet();
            string        sqlString  = WebConfigurationManager.ConnectionStrings["MicahBealeDataBaseConnectionString_Master"].ConnectionString;
            SqlConnection connection = new SqlConnection(sqlString);

            connection.Open();
            SqlCommand     command = new SqlCommand(selectDrop, connection);
            SqlDataAdapter adapter = new SqlDataAdapter(command);

            adapter.Fill(drop);
            DropDown.DataSource    = drop;
            DropDown.DataTextField = "CategoryName";
            DropDown.DataBind();
            DropDown.Visible = true;
            string         selectBrand   = "SELECT BrandName FROM Brands";
            DataSet        brand         = new DataSet();
            SqlCommand     secondCommand = new SqlCommand(selectBrand, connection);
            SqlDataAdapter secondAdapter = new SqlDataAdapter(secondCommand);

            secondAdapter.Fill(brand);
            BrandDropDown.DataSource    = brand;
            BrandDropDown.DataTextField = "BrandName";
            BrandDropDown.DataBind();
            BrandDropDown.Visible = true;
            connection.Close();
        }
Exemple #3
0
        public void HienThiDropType1(string Sitemtp, string Sitemtp1)
        {
            DataTable dt = dalType.LayStypeVN1(Sitemtp, Sitemtp1);

            if (dt.Rows.Count > 0)
            {
                string ngonngu = Session["languege"].ToString();
                if (ngonngu == "lbl_VN")
                {
                    DropDown.DataSource     = dt;
                    DropDown.DataValueField = "Sitemtp";
                    DropDown.DataTextField  = "Stpnamevn";
                    DropDown.DataBind();
                }
                else if (ngonngu == "lbl_TW")
                {
                    DropDown.DataSource     = dt;
                    DropDown.DataValueField = "Sitemtp";
                    DropDown.DataTextField  = "Stpnamech";
                    DropDown.DataBind();
                }
                else if (ngonngu == "lbl_EN")
                {
                    DropDown.DataSource     = dt;
                    DropDown.DataValueField = "Sitemtp";
                    DropDown.DataTextField  = "Stpnameen";
                    DropDown.DataBind();
                }
            }
        }
Exemple #4
0
        protected void DropDown_Init(object sender, EventArgs e)
        {
            if (DropDown == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(this.OnClientChange))
            {
                DropDown.Attributes["onchange"] = this.OnClientChange;
            }

            Assembly assembly = null;

            foreach (AssemblyName assemblyName in Assembly.GetExecutingAssembly().GetReferencedAssemblies())
            {
                if (DataSourceTypeName.Contains(assemblyName.Name))
                {
                    assembly = Assembly.Load(assemblyName);
                    break;
                }
            }

            if (assembly == null)
            {
                return;
            }

            Type dsType = assembly.GetType(DataSourceTypeName);

            if (dsType == null)
            {
                return;
            }

            using (IDisposable o = (IDisposable)Activator.CreateInstance(dsType))
            {
                MethodInfo dsMethod = dsType.GetMethod(DataSourceMethod);
                if (dsMethod == null)
                {
                    return;
                }

                DropDown.DataTextField  = this.DataTextField;
                DropDown.DataValueField = this.DataValueField;
                DropDown.DataSource     = dsMethod.Invoke(o, null);
                DropDown.DataBind();

                if (ShowAll)
                {
                    DropDown.Items.Insert(0, new ListItem {
                        Text = "-- Todos --", Value = ""
                    });
                }
            }
        }
Exemple #5
0
        public void HienThiDropType()
        {
            DataTable dt = dalType.LayStypeVN();

            if (dt.Rows.Count > 0)
            {
                DropDown.DataSource     = dt;
                DropDown.DataValueField = "Sitemtp";
                DropDown.DataTextField  = "Stpnamevn";
                DropDown.DataBind();
            }
        }