📄 showitem.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_ShowItem : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
object oItemID = Request.Params["itemid"];
string strScriptBlock = null;
if (oItemID == null)
{
strScriptBlock = @"alert('请选择正确的ID!');window.navigate('manageitem.aspx');";
ClientScript.RegisterClientScriptBlock(this.GetType(), this.UniqueID + "NoItemID", strScriptBlock, true);
}
else
{
eNewsItem eni = new eNewsItem();
if (!eni.IsItemIDExist(Convert.ToInt32(oItemID)))
{
strScriptBlock = @"alert('该ID不存在!');window.navigate('manageitem.aspx');";
ClientScript.RegisterClientScriptBlock(this.GetType(), this.UniqueID + "ItemIDNotExist", strScriptBlock, true);
}
else
{
{
if (!IsPostBack)
{
eni.GetItemByID(Convert.ToInt32(oItemID));
BindData(eni);
}
}
}
}
}
private void BindData(eNewsItem peni)
{
lblItemEName.Text = peni.NewsItemEName;
tbxItemName.Text = peni.NewsItemName;
rblShowAtHome.SelectedValue = Convert.ToInt32(peni.NewsShowAtHome).ToString();
hfldItemID.Value = peni.NewsItemID.ToString();
}
protected void btnConfirm_Click(object sender, EventArgs e)
{
object oItemID = hfldItemID.Value;
string strScriptBlock = null;
if (oItemID == null)
{
strScriptBlock = @"alert('请选择正确的ID!');window.navigate('manageitem.aspx');";
ClientScript.RegisterClientScriptBlock(this.GetType(), this.UniqueID + "NoItemID", strScriptBlock, true);
}
else
{
eNewsItem eni = new eNewsItem(Convert.ToInt32(Request.Params["itemid"]));
if (eni.NewsItemName != tbxItemName.Text && eni.IsItemNameExist(tbxItemName.Text))
{
strScriptBlock = @"alert('该栏目名称已存在!');";
ClientScript.RegisterClientScriptBlock(this.GetType(), this.UniqueID + "ItemNameExist", strScriptBlock, true);
return;
}
bool blnShowAtHome = false;
if (rblShowAtHome.SelectedValue == "1")
blnShowAtHome = true;
eni.SetItemInfo(Convert.ToInt32(oItemID), tbxItemName.Text, blnShowAtHome);
Application["Items"] = eni.GetAllItem();
strScriptBlock = @"alert('修改栏目信息成功!');window.navigate('manageitem.aspx');";
ClientScript.RegisterClientScriptBlock(this.GetType(), this.UniqueID + "ItemENameExist", strScriptBlock, true);
}
}
protected void btnCancle_Click(object sender, EventArgs e)
{
Server.Transfer("manageitem.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -