private void Load_distric(int id) { var list = user.Loaddistric(id); if (list.Count > 0) { Drdistric.DataValueField = "PROP_ID"; Drdistric.DataTextField = "PROP_NAME"; Drdistric.DataSource = list; Drdistric.DataBind(); ListItem l = new ListItem("---Chọn quận/huyện---", "0"); l.Selected = true; Drdistric.Items.Insert(0, l); } else { DataTable dt = new DataTable("Newtable"); dt.Columns.Add(new DataColumn("PROP_ID")); dt.Columns.Add(new DataColumn("PROP_NAME")); DataRow row = dt.NewRow(); row["PROP_ID"] = 0; row["PROP_NAME"] = "---Chọn quận/huyện---"; dt.Rows.Add(row); Drdistric.DataTextField = "PROP_NAME"; Drdistric.DataValueField = "PROP_ID"; Drdistric.DataSource = dt; Drdistric.DataBind(); } }
private void Load_distric(int id) { var list = db.ESHOP_PROPERTies.Where(n => n.PROP_RANK == 3 && n.PROP_PARENT_ID == id).ToList(); if (list.Count > 0) { Drdistric.DataValueField = "PROP_ID"; Drdistric.DataTextField = "PROP_NAME"; Drdistric.DataSource = list; Drdistric.DataBind(); ListItem l = new ListItem("--- Quận/Huyện ---", "0"); l.Selected = true; Drdistric.Items.Insert(0, l); } else { DataTable dt = new DataTable("Newtable"); dt.Columns.Add(new DataColumn("PROP_ID")); dt.Columns.Add(new DataColumn("PROP_NAME")); DataRow row = dt.NewRow(); row["PROP_ID"] = 0; row["PROP_NAME"] = "--- Quận/Huyện ---"; dt.Rows.Add(row); Drdistric.DataTextField = "PROP_NAME"; Drdistric.DataValueField = "PROP_ID"; Drdistric.DataSource = dt; Drdistric.DataBind(); } }
protected void Drcity_SelectedIndexChanged(object sender, EventArgs e) { int id = Utils.CIntDef(Drcity.SelectedValue); Load_distric(id); Drdistric.Focus(); }
protected void Drcity_SelectedIndexChanged(object sender, EventArgs e) { txtPassword1.Attributes.Add("value", txtPassword1.Text); txtRePassword.Attributes.Add("value", txtRePassword.Text); int id = Utils.CIntDef(Drcity.SelectedValue); Load_distric(id); Drdistric.Focus(); }
private void loadDistric(int id) { var list = DB.ESHOP_PROPERTies.Where(n => n.PROP_RANK == 3 && n.PROP_PARENT_ID == id); Drdistric.DataValueField = "PROP_ID"; Drdistric.DataTextField = "PROP_NAME"; Drdistric.DataSource = list; Drdistric.DataBind(); ListItem l = new ListItem("---Quận/huyện---", "0"); l.Selected = true; Drdistric.Items.Insert(0, l); }