温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:明日供求信息网源码
当前文件:
MingriGongQiu/BackGround/LeaguerInfoDelete.aspx.cs,打开代码结构图
MingriGongQiu/BackGround/LeaguerInfoDelete.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
12
public partial class BackGround_LeaguerInfoDelete : System.Web.UI.Page 13
{ 14
Operation operation = new Operation(); 15
static string infoType = ""; //供求信息类型 16
static int CheckType = -1; //3种类别:全部显示(-1代表全部显示),显示过期信息(0),显示未过期信息(1) 17
18
protected void Page_Load(object sender, EventArgs e) 19
{ 20
if (!IsPostBack) 21
this.GridViewBind(); 22
} 23
private void GridViewBind() 24
{ 25
GridView1.DataSource = operation.SelectLeaguerInfo(); 26
GridView1.DataKeyNames = new string[] {"id" }; 27
GridView1.DataBind(); 28
} 29
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) 30
{ 31
GridView1.PageIndex = e.NewPageIndex; 32
//按过期类型绑定数据(3种类别:全部显示(-1),显示过期(0),显示未过期(1)) 33
switch (CheckType) 34
{ 35
case -1: 36
GridViewBind(); 37
break; 38
case 0: 39
GridView1.DataSource = operation.SelectLeaguerInfo(false); 40
GridView1.DataBind(); 41
break; 42
case 1: 43
GridView1.DataSource = operation.SelectLeaguerInfo(true); 44
GridView1.DataBind(); 45
break; 46
} 47
} 48
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 49
{ 50
if (e.Row.RowType == DataControlRowType.DataRow) 51
{ 52
//高亮显示指定行 53
e.Row.Attributes.Add("onMouseOver", "Color=this.style.backgroundColor;this.style.backgroundColor='#FFF000'"); 54
e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=Color;"); 55
//进行时间格式化 56
e.Row.Cells[5].Text = Convert.ToDateTime(e.Row.Cells[5].Text).ToShortDateString(); 57
//删除指定行数据时,弹出询问对话框 58
((LinkButton)(e.Row.Cells[8].Controls[0])).Attributes.Add("onclick", "return confirm('是否删除当前行数据!')"); 59
//多余字 使用...显示 60
e.Row.Cells[1].Text = StringFormat.Out(e.Row.Cells[2].Text, 7); 61
e.Row.Cells[2].Text = StringFormat.Out(e.Row.Cells[2].Text, 16); 62
} 63
} 64
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) 65
{ 66
operation.DeleteLeaguerInfo(GridView1.DataKeys[e.RowIndex].Value.ToString()); 67
this.GridViewBind(); 68
} 69
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) 70
{ 71
string id = GridView1.DataKeys[e.NewSelectedIndex].Value.ToString(); 72
infoType = GridView1.DataKeys[e.NewSelectedIndex][0].ToString(); 73
Response.Write("<script> window.open('DetailLeaguerInfo.aspx?id=" + id + "','','scrollbars') </script>"); 74
Response.Write("<script>history.go(-1)</script>"); 75
} 76
protected void rdoBtnAll_CheckedChanged(object sender, EventArgs e) 77
{ 78
CheckType = -1; 79
this.GridViewBind(); 80
} 81
protected void rdoBtnTrue_CheckedChanged(object sender, EventArgs e) 82
{ 83
CheckType = 1; 84
GridView1.DataSource = operation.SelectLeaguerInfo(true); 85
GridView1.DataBind(); 86
} 87
protected void rdoBtnFalse_CheckedChanged(object sender, EventArgs e) 88
{ 89
CheckType = 0; 90
GridView1.DataSource = operation.SelectLeaguerInfo(false); 91
GridView1.DataBind(); 92
} 93
} 94
95




Operation operation 
}
}