protected void gv_Budget_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string text = this.gvBudget.DataKeys[e.Row.RowIndex].Value.ToString(); CostAccounting byId = CostAccounting.GetById(text); e.Row.Attributes["layer"] = (byId.Code.Length / 3).ToString(); e.Row.Attributes["orderNumber"] = byId.Code; e.Row.Attributes["id"] = text; e.Row.Attributes["code"] = this.gvBudget.DataKeys[e.Row.RowIndex].Values[1].ToString(); string text2 = e.Row.Cells[3].Text; if (text2 == "D") { text2 = "直接成本"; } else { if (text2 == "I") { text2 = "间接成本"; } else { text2 = string.Empty; } } e.Row.Cells[3].Text = text2; } }
protected void BindUpdateData(string id) { CostAccounting byId = CostAccounting.GetById(id); this.txtCBSCode.Text = byId.Code; this.txtCBSName.Text = byId.Name; this.txtNote.Text = byId.Note; this.ddlType.SelectedValue = byId.Type; }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { string strA = base.Request["action"]; string text = base.Request["parent"]; if (string.Compare(strA, "add", true) == 0) { this.txtCBSCode.Text = CostAccounting.GetCode(text); this.ddlType.SelectedValue = CostAccounting.GetById(text).Type; } else { if (string.Compare(strA, "update", true) == 0) { this.BindUpdateData(text); } } //this.ddlType.SelectedValue == "I"; } }