Hello,CNDS!(第一次博客)

仰望星空、脚踏实地、厚积薄发

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class article_edit : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { banddata(); } } public void banddata() { //绑定页面数据,分两种一情况,分别为新增,修改,分开对待 Article o_article = new Article(); string ftypeid = ""; //request["fid"]非空时,表示当前操作为修改操作,此时,对页面进行填充 if (Request["fid"] != null) { o_article=o_article.get(Request["fid"].ToString()); txttitle.Text = o_article.ftitle; ftypeid = o_article.ftype; txtjj.Text = o_article.fremark; txtsource.Text = o_article.fsource; txtcontent.Text = o_article.fcontent; } o_article.bandarticletype(droptype, ""); } protected void btnsave_Click(object sender, EventArgs e) { if (txttitle.Text == ""||txttitle.Text.Length>20) { showmsg("文章标题不能为空或者长度超长(最长不超过20个字)!"); return; } if (txtjj.Text == ""||txtjj.Text.Length>100) { showmsg("文章简介不能为空或者长度超长(最长不超过100字)!"); return; } if (txtcontent.Text == "") { showmsg("文章内容不能为空!"); return; } Article o_article=new Article(); o_article.ftitle=txttitle.Text; o_article.ftype=droptype.SelectedValue; o_article.fremark=txtjj.Text; o_article.fsource=txtsource.Text; o_article.fcontent=txtcontent.Text; bool result=false; if (Request["fid"]==null) { result=o_article.Add(o_article); } else{ result=o_article.update(o_article,Request["fid"].ToString()); } if (result) { showmsg("文章信息保存成功!"); } if (Request["fid"]==null) { txttitle.Text=""; droptype.SelectedIndex=0; txtjj.Text=""; txtsource.Text=""; txtcontent.Text=""; } } public void showmsg(string msgstr) { Response.Write("[removed]"); Response.Write("alert('" + msgstr + "')"); Response.Write("[removed]"); } }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值