温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Handson简单新闻系统后台源码
当前文件:
HandsonNews/NewsClassManage/ClassManage.aspx.cs[1K,2009-6-12 11:43:42],打开代码结构图
HandsonNews/NewsClassManage/ClassManage.aspx.cs[1K,2009-6-12 11:43:42],打开代码结构图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
using System.Data.SqlClient; 12
13
public partial class NewsClassManage_ClassManage : System.Web.UI.Page 14
{ 15
protected void Page_Load(object sender, EventArgs e) 16
{ 17
18
} 19
protected void GrdClassManage_RowDataBound(object sender, GridViewRowEventArgs e) 20
{ 21
// 为每一个数据行添加两个属性,实现当鼠标经过时高亮的效果 22
23
if (e.Row.RowType == DataControlRowType.DataRow) 24
{ 25
//鼠标移到该行时所在行变颜色,移出时恢复原来颜色 26
27
e.Row.Attributes.Add("onMouseOver", "this.style.cursor='hand';this.originalcolor=this.style.backgroundColor;this.style.backgroundColor='Silver';"); 28
e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=this.originalcolor;"); 29
} 30
if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowType != DataControlRowType.Header 31
&& e.Row.RowType != DataControlRowType.Footer && e.Row.RowType != DataControlRowType.EmptyDataRow 32
&& e.Row.RowState != DataControlRowState.Edit && e.Row.RowState != (DataControlRowState.Alternate | DataControlRowState.Edit)) 33
{ 34
//onclick删除按钮事件时,弹出确认对话框,提示您是否要删除该记录 35
36
((LinkButton)e.Row.Cells[6].Controls[0]).Attributes.Add("onclick", "return confirm('你确认要删除分类名称为[" + e.Row.Cells[1].Text + "] 的这条记录吗?');"); 37
38
} 39
//try 40
//{ 41
// int a = int.Parse(e.Row.Cells[4].Text); 42
//} 43
//catch (FormatException) 44
//{ 45
// Response.Write("<script>window.alert('请输入整数!')</script>"); 46
//} 47
} 48
49
50
} 51
52






}
}