using System;
using System.Web.UI.WebControls;
namespace baoge.Admin
{
	/// <summary>
	/// static_class 的摘要说明。
	/// </summary>
	public class static_class
	{
		protected ListItemType type;
		protected LinkButton btndel;
		public static_class()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		#region 更改datagrid自定义翻页
		static public void Set_Page(DataGridItemEventArgs e,DataGrid grid_id)
		{
			ListItemType type=e.Item.ItemType;
			if(type==ListItemType.Pager)
			{
				type=e.Item.ItemType;
				TableCell pager = (TableCell)e.Item.Controls[0];
				Label text1=new Label();
				text1.EnableViewState=false;
				pager.Controls.Add(text1);
				text1.Text="&nbsp;&nbsp;&nbsp;&nbsp;共有"+grid_id.PageCount+"页";
				for ( int i=0; i<pager.Controls.Count; i+=2 )
				{
					object o = pager.Controls[i];
					if (o is LinkButton )
					{
						LinkButton h = (LinkButton)o;
						h.Text="["+h.Text+"]";
					}
					else
					{
						Label l=(Label)o;
						l.Text="<font color=\"#FF0000\">第"+l.Text+"页</font>";
					}
				}
			}
		}
		#endregion

		#region 动态添加确认框
		static public void Set_del(DataGridItemEventArgs e,int i)
		{
			if(e.Item.ItemType==ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem || e.Item.ItemType==ListItemType.EditItem)
			{
				LinkButton btndel=(LinkButton)e.Item.Cells[i].Controls[0];
				btndel.Attributes.Add("onclick","return confirm('您确认要删除此栏目?');");
			}
		}
		#endregion
	}
}
