private void TreeBind() { BLL.village bll = new BLL.village(); DataTable dt = bll.GetList(0); this.ddlParentId.Items.Clear(); this.ddlParentId.Items.Add(new ListItem("无父级分类", "0")); foreach (DataRow dr in dt.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["name"].ToString().Trim(); if (ClassLayer == 1) { this.ddlParentId.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlParentId.Items.Add(new ListItem(Title, Id)); } } }
//数据绑定 private void RptBind() { BLL.village bll = new BLL.village(); DataTable dt = bll.GetList(0); this.rptList.DataSource = dt; this.rptList.DataBind(); }
private string action = DTEnums.ActionEnum.Add.ToString(); //操作类型 protected void Page_Load(object sender, EventArgs e) { BLL.village bll = new BLL.village(); DataTable dtVillage = bll.GetList(0); this.cunlist.DataBind(); cunlist.Items.Clear(); cunlist.Items.Add(new ListItem("请选择", "0")); foreach (DataRow dr in dtVillage.Rows) { string Id = dr["id"].ToString(); string Title = dr["name"].ToString().Trim(); cunlist.Items.Add(new ListItem(Title, Id)); } var start = 1991; var end = DateTime.Now.Year; agesye.Items.Add(new ListItem("请选择年份", "0")); for (int i = start; i <= end; i++) { agesye.Items.Add(new ListItem(i.ToString(), i.ToString())); } ; for (int i = 1; i <= 150; i++) { age.Items.Add(new ListItem(i.ToString(), i.ToString())); } ; this.name.Text = "张三1"; this.peiouxingming.Text = "张三2"; this.jichengren.Text = "cxvxcv"; this.cunzu.Text = "ewqe掐我v"; this.jiatingshouru.Text = "驱蚊器无"; this.jiekuanyongtu.Text = "恶趣味"; this.jiekuanjine.Text = "全文我去额"; this.shenqings1.Text = "张 全文三"; this.shenqings2.Text = "张而我却三"; this.shenqings3.Text = "张擦擦擦三"; this.shenqings4.Text = "张三"; this.xiaozuyijian1.Text = "张三"; this.xiaozuyijian2.Text = "张三"; this.name.Text = "张三"; this.name.Text = "张三"; this.jiekuanstart.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); this.jiekuanend.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); this.jiekuantime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); this.xiaozutime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); this.xieshenpiyijian.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); this.jianshiyijian.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); }
//保存 public void town_Change_Click(object sender, EventArgs e) { ddlVillage.Items.Clear(); BLL.village subjectBll = new BLL.village(); DataTable dtVillage = subjectBll.GetList(Utils.StrToInt(ddlTown.SelectedValue, 0)); foreach (DataRow dr in dtVillage.Rows) { string Id = dr["id"].ToString(); string Title = dr["name"].ToString().Trim(); ddlVillage.Items.Add(new ListItem(Title, Id)); var rowIndex = dtVillage.Rows.IndexOf(dr); if (rowIndex == 0) { txtVillage.Text = Title; } } }
//保存 public void town_Change_Click(object sender, EventArgs e) { for (int i = 0; i < 10; i++) { if (ddlVillage.SelectedValue.ToString() != "0") { ddlVillage.Items.Clear(); BLL.village subjectBll = new BLL.village(); DataTable dtVillage = subjectBll.GetList(Utils.StrToInt(ddlTown.SelectedValue, 0)); foreach (DataRow dr in dtVillage.Rows) { string Id = dr["id"].ToString(); string Title = dr["name"].ToString().Trim(); ddlVillage.Items.Add(new ListItem(Title, Id)); } } } }