public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtTitle.Text.Trim().Length == 0) { strErr += "广告位名称不能为空!\\n"; } if (!PageValidate.IsNumber(txtWidth.Text)) { strErr += "宽度必须为数字!\\n"; } if (!PageValidate.IsNumber(txtHeight.Text)) { strErr += "高度必须为数字!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } hm.BLL.ad_pos bll = new hm.BLL.ad_pos(); hm.Model.ad_pos model = bll.GetModel(int.Parse(lblId.Text)); model.title = this.txtTitle.Text; model.types = int.Parse(ddlTypes.SelectedValue); model.width = int.Parse(txtWidth.Text); model.height = int.Parse(txtHeight.Text); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "Aplist.aspx"); }
private void ShowInfo(int siId) { hm.BLL.ad_pos bll = new hm.BLL.ad_pos(); hm.Model.ad_pos model = bll.GetModel(siId); lblId.Text = model.id.ToString(); txtTitle.Text = model.title; txtWidth.Text = model.width.ToString(); txtHeight.Text = model.height.ToString(); ddlTypes.SelectedValue = model.types.ToString(); }