如题,小弟刚接触asp.net不久,所以有很多不懂,望高手们不吝赐教。
下面进入正题,后台代码如下
<pre name="code" class="csharp"> protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)//判定当前的行是否属于datarow类型的行
{
//当鼠标放上去的时候 先保存当前行的背景颜色 并给附一颜色
e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#7f9edb',this.style.fontWeight='';");
//当鼠标离开的时候 将背景颜色还原的以前的颜色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';");
//当鼠标放上时,指针为手指的形状
e.Row.Attributes["style"] = "cursor:hand";
//添加行点击事件
//e.Row.Attributes.Add("onclick", "SelectClick(" + e.Row.RowIndex + ")");
//点击行触发SelectedIndexChanged事件
PostBackOptions myPostBackOptions = new PostBackOptions(this);
myPostBackO