protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request["kind"] != null && Request["kind"].Trim() != String.Empty) { ZCStatusBU bu1 = new ZCStatusBU(); this.dckind.Text = bu1.GetTextByStatus(Request["kind"]); bu1.Close(); } } }
//设置资产状态 public static void SetZCStatus(ListControl drop1, string blankValue) { ZCStatusBU status1 = new ZCStatusBU(); DataSet ds1 = status1.GetAllZcStatus(); status1.Close(); for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { ListItem list1 = new ListItem(ds1.Tables[0].Rows[i][0].ToString(), ds1.Tables[0].Rows[i][1].ToString()); drop1.Items.Add(list1); } if (blankValue != null && blankValue != "") { ListItem list1 = new ListItem(blankValue, ""); drop1.Items.Insert(0, list1); } }
/// <summary> /// 设置页面上控件的值 /// </summary> /// <param name="ht"></param> public void SetControlData(Hashtable ht) { foreach (String m in this.contrArrName) { if (ht.ContainsKey(m)) { Control con1 = this.FindControl(m) as Control; if (con1 != null) { Util.SetControlValue(con1, ht[m]); //设置控件的值 } Control con2 = this.FindControl(m + "_1") as Control; if (con2 != null) { Util.SetControlValue(con2, ht[m]); //设置控件的值 } } } //调整部分数据的显示 if (this.zqce.Text.Trim() != String.Empty) { this.zqce.Text = String.Format("{0:N2}", double.Parse(this.zqce.Text)); this.zqce_1.Text = String.Format("{0:N2}", double.Parse(this.zqce.Text)); } if (this.benjin.Text.Trim() != String.Empty) { this.benjin.Text = String.Format("{0:N2}", double.Parse(this.benjin.Text)); this.benjin_1.Text = String.Format("{0:N2}", double.Parse(this.benjin.Text)); } if (this.lixi.Text.Trim() != String.Empty) { this.lixi.Text = String.Format("{0:N2}", double.Parse(this.lixi.Text)); this.lixi_1.Text = String.Format("{0:N2}", double.Parse(this.lixi.Text)); } if (this.shijian1.Text.Trim() != String.Empty) { this.shijian1.Text = DateTime.Parse(this.shijian1.Text).ToString("yyyy-MM-dd"); this.shijian1_1.Text = DateTime.Parse(this.shijian1.Text).ToString("yyyy-MM-dd"); } if (this.shijian2.Text.Trim() != String.Empty) { this.shijian2.Text = DateTime.Parse(this.shijian2.Text).ToString("yyyy-MM-dd"); this.shijian2_1.Text = DateTime.Parse(this.shijian2.Text).ToString("yyyy-MM-dd"); } //得到状态的显示 ZCStatusBU bu1 = new ZCStatusBU(); this.statusText.Text = bu1.GetTextByStatus(this.status.Text); this.statusText_1.Text = this.statusText.Text; bu1.Close(); if (ht["zeren"].ToString() == Page.User.Identity.Name) { this.tab2.Visible = false; } else { this.tab1.Visible = false; } }