protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindSuperior(); string id = Request.QueryString["OrganID"].ToString(); Organ organ = organBLL.GetModel(int.Parse(id)); if (organ != null) { txt_ID.Text = organ.OrganID.ToString(); txt_Name.Text = organ.OrganName; txt_Remark.Text = organ.Remark; ddl_Level.SelectedValue = organ.Level.ToString(); ddl_Superior.SelectedValue = organ.Superior.ToString(); } } }
private void BindGV() { OrganBLL organBLL = new OrganBLL(); IList <Organ> ds = organBLL.GetModelList(""); foreach (Organ o in ds) { Organ oa = organBLL.GetModel(o.Superior); if (oa == null) { o.SuperiorName = "无"; } else { o.SuperiorName = oa.OrganName; } } GridView1.DataSource = ds; GridView1.DataBind(); }