/// <summary> /// 添加友情连接 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { string name = this.txtLinkName.Text.Trim(); string title = txtTitle.Text.Trim(); string content = this.content1.Value; if (name.Length == 0 || content.Length == 0) { lblError.Text = "各项不能为空"; return; } AboutMenu item = new AboutMenu(); item.proName = name; item.proValue = content; item.infoType = 0; item.remark = title; if (lblId.Text != "") { item.id = Convert.ToInt32(lblId.Text.Trim()); AboutMenuService.Update(item); } else { AboutMenuService.Add(item); } pnlAdd.Visible = false; pnlList.Visible = true; sp.InitBindData(repInfo, pager1, "AboutMenu", "id", sear()); }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { if (id == 6 || id == 7) { AboutMenu item = AboutMenuService.GetModel(id); if (item != null) { item.proValue = content1.Value; AboutMenuService.Update(item); } } else { AboutMenuService.SetValue(id, content1.Value); } ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('保存成功!');", true); }