日期:2014-05-17 浏览次数:20475 次
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; public partial class Masters_AdminBlue_Demo_Add : System.Web.UI.Page { private int CateId; protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { if (Request.QueryString["CateId"] != null) { CateId = Convert.ToInt32(Request.QueryString["CateId"].ToString()); ViewState["cateID"] = Convert.ToInt32(Request.QueryString["CateId"].ToString()); } } } protected void Button1_Click1(object sender, EventArgs e) { COOL.NEWSTableAdapters.CMS_ContentTableAdapter adp = new COOL.NEWSTableAdapters.CMS_ContentTableAdapter(); COOL.NEWS.CMS_ContentDataTable dt = new COOL.NEWS.CMS_ContentDataTable(); COOL.NEWS.CMS_ContentRow dr =dt.NewCMS_ContentRow(); dr.CateID = int.Parse(ViewState["cateID"].ToString()); dr.CMS_Cnt =Convert.ToString(FCKeditor1.Value); dr.CMS_Title =Convert.ToString(tbOld.Text) ; dt.AddCMS_ContentRow(dr); if (adp.Update(dt) > 0) { Tool.Message.ClientMsgPrompt(this, "添加成功"); tbOld.Text = ""; FCKeditor1.Value = ""; } else { Tool.Message.ClientMsgPrompt(this, "添加失败"); } } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect(string.Format("Add.aspx?CateId={0}", int.Parse(ViewState["cateID"].ToString()))); } }
------解决方案--------------------