protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtFuncName.Text.Trim().Length == 0) { strErr += "FuncName不能为空!\\n"; } if (this.txtFuncAbbr.Text.Trim().Length == 0) { strErr += "FuncAbbr不能为空!\\n"; } //if(!PageValidate.IsNumber(txtMID.Text)) //{ // strErr+="MID格式错误!\\n"; //} //if(strErr!="") //{ // MessageBox.Show(this,strErr); // return; //} string FuncName = this.txtFuncName.Text; string FuncAbbr = this.txtFuncAbbr.Text; int MID = int.Parse(this.txtMID.Text); CHSS.Model.CFunction model = new CHSS.Model.CFunction(); model.FuncName = FuncName; model.FuncAbbr = FuncAbbr; model.MID = MID; CHSS.BLL.CFunction bll = new CHSS.BLL.CFunction(); bll.Add(model); //Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx"); }
private void ShowInfo(int FID) { CHSS.BLL.CFunction bll = new CHSS.BLL.CFunction(); CHSS.Model.CFunction model = bll.GetModel(FID); this.lblFID.Text = model.FID.ToString(); this.txtFuncName.Text = model.FuncName; this.txtFuncAbbr.Text = model.FuncAbbr; this.txtMID.Text = model.MID.ToString(); }
protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { DataRowView drv = (DataRowView)e.Item.DataItem; DataSet ds = new CHSS.BLL.CFunction().GetList("MID=" + drv.Row["MID"].ToString()); CheckBoxList MyCheckBoxList = (CheckBoxList)e.Item.FindControl("MyCheckBoxList"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { ListItem li = new ListItem(); li.Text = ds.Tables[0].Rows[i]["FuncName"].ToString(); li.Value = ds.Tables[0].Rows[i]["FID"].ToString(); MyCheckBoxList.Items.Add(li); } }