1 protected void gvUseOperateLogs_RowDataBound(object sender, GridViewRowEventArgs e) 2 3 { 4 5 if (e.Row.RowType == DataControlRowType.Header) 6 7 { 8 9 e.Row.CssClass = "Grid_AlternatingItem"; 10 11 } 12 13 14 15 if (e.Row.RowType == DataControlRowType.DataRow) 16 17 { 18 19 e.Row.Attributes["onmouseover"] = 20 21 "this.style.cursor='hand';this.style.textDecoration='underline';"; 22 23 e.Row.Attributes["onmouseout"] = 24 25 "this.style.textDecoration='none';"; 26 27 e.Row.Attributes.Add("id", "gvResult_row_" + e.Row.RowIndex); 28 29 30 31 // 32 33 //給gridview添加行雙擊事件 34 35 e.Row.Attributes["ondblclick"] = string.Format("window.location.href='UseOperateLog_Detail.aspx?IDSeqNo={0}'",((Label)e.Row.FindControl("lblIDSeqNo")).Text); 36 37 //根據單雙號進行樣式設定 38 39 //if (e.Row.RowIndex % 2 != 0) 40 41 //{ 42 43 // e.Row.CssClass = "Grid_AlternatingItem"; 44 45 // //設定選中的樣式 46 47 // e.Row.Attributes["onclick"] = "SeletedRow('gvResult_row_" + e.Row.RowIndex + "','Grid_AlternatingItem'," + e.Row.RowIndex + ");"; 48 49 //} 50 51 //else 52 53 //{ 54 55 e.Row.CssClass = "Grid_OddItem"; 56 57 //設定選中的樣式 58 59 e.Row.Attributes["onclick"] = "SeletedRow('gvResult_row_" + e.Row.RowIndex + "','Grid_OddItem'," + e.Row.RowIndex + ");"; 60 61 //} 62 63 } 64 65 } 66 1.