|
|
| 在DataGrid中,使鼠标到达的行和列显示不同的颜色 |
| 作者:不详 来源:不详 发布时间:2006-8-14 9:43:35 发布人:chinazhan |
减小字体
增大字体
如下图所示:  核心代码: private void grdCustomer_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if(e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item ) { e.Item.Attributes.Add("onmouseover", "this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='#C8F7FF'"); e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=this.oldcolor"); for (int i = 0; i< grdCustomer.Columns.Count; i++ ) { e.Item.Cells[i].Attributes.Add("onmouseover", "this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='#99ccff'"); e.Item.Cells[i].Attributes.Add( "onmouseout", "this.style.backgroundColor=this.oldcolor"); } } } 做人要厚道,请注明转自chinazhan中国站长(www.ChinaZhan.com)。
|
| |
|
[]
[返回上一页]
[打 印]
[收 藏] |
|
| ∷相关文章评论∷ (评论内容只代表网友观点,与本站立场无关!) [更多评论...] |
|
|