日期:2008-12-21 浏览次数:20468 次
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
namespace ygdzwww
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.LinkButton PageFirst;
protected System.Web.UI.WebControls.LinkButton PageNext;
protected System.Web.UI.WebControls.LinkButton PageLast;
protected System.Web.UI.WebControls.LinkButton PagePre;
protected System.Web.UI.WebControls.Button BTXianDelete;
protected System.Web.UI.WebControls.Button BTXianSearch;
protected System.Web.UI.WebControls.Label LBXianName;
protected System.Web.UI.WebControls.TextBox TBXianName;
protected System.Web.UI.WebControls.Label LBPageCount;
protected System.Web.UI.WebControls.Button BTXianAdd;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack)
{
DataGrid1.DataSource=new YGDZ.WKR_T01_01_1Service().GetAll();
DataGrid1.DataBind();
LBPageCount.Text = "第"+((Int32) DataGrid1.CurrentPageIndex +1)+"页"+"/共"+DataGrid1.PageCount +"页";
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.BTXianAdd.Click += new System.EventHandler(this.BTXianAdd_Click);
this.BTXianDelete.Click += new System.EventHandler(this.BTXianDelete_Click);
this.BTXianSearch.Click += new System.EventHandler(this.BTXianSearch_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void BTXianAdd_Click(object sender, System.EventArgs e)
{
Response.Redirect("YGDZ_xianadd.aspx" );
}
public void PageButton(object sender, System.EventArgs e)
{
string arg=((LinkButton)sender).CommandArgument;
switch(arg)
{
case ("pagefirst"):
DataGrid1.CurrentPageIndex=0;
break;
case ("pagenext"):
if(DataGrid1.CurrentPageIndex<(DataGrid1.PageCount -1))
DataGrid1.CurrentPageIndex ++;
break;
case ("pagepre"):
if(DataGrid1.CurrentPageIndex>0)
DataGrid1.CurrentPageIndex --;
break;
case ("pagelast"):