📄 addnewsitem.aspx.cs
字号:
using System;
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 Admin_AddNewsItem : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnConfirm_Click(object sender, EventArgs e)
{
eNewsItem eni = new eNewsItem();
string strScriptBlock = null;
if (eni.IsItemENameExist(tbxItemEName.Text))
{
strScriptBlock = "alert('栏目目录名已存在!');";
}
else if (eni.IsItemNameExist(tbxItemName.Text))
{
strScriptBlock = "alert('栏目名称已存在!');";
}
else
{
bool blnShowAtHome;
if (rblShowAtHome.SelectedValue == "0")
blnShowAtHome = false;
else
blnShowAtHome = true;
string strPathName = Server.MapPath("~/");
string strResult = eni.AddItem(tbxItemName.Text, tbxItemEName.Text, blnShowAtHome, strPathName);
if (strResult == null)
{
strScriptBlock += @"
if(confirm('添加成功,是否还添加栏目?'))
{
window.navigate('addnewsitem.aspx');
}
else
{
window.navigate('manageitem.aspx');
}";
Application["Items"] = eni.GetAllItem();
}
else
{
strScriptBlock += @"
alert('" + strResult + @"');
history.back();
";
}
}
ClientScript.RegisterClientScriptBlock(this.GetType(), this.UniqueID + "AddSuccess", strScriptBlock,true);
}
protected void btnCancle_Click(object sender, EventArgs e)
{
Server.Transfer("manageitem.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -