谢谢帮忙! private void Grid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType=e.Item.ItemType; e.Item.Attributes["onmouseover"]="javascript:this.style.backgroundColor='#0099cc'"; if (itemType==ListItemType.Item)
{
e.Item.Attributes["onmouseout"]="javascript:this.style.backgroundColor='#FFFFFF'";
} else if(itemType==ListItemType.AlternatingItem)
{
e.Item.Attributes["onmouseout"]="javascript:this.style.backgroundColor='#EFEFEF'";
} if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem)
{
ImageButton button = (ImageButton) e.Item.FindControl("delbutton");
button.Attributes.Add ("onclick","return confirm (\"确定要删除此项记录吗?\");");
}
}
{
ListItemType itemType=e.Item.ItemType; e.Item.Attributes["onmouseover"]="javascript:this.style.backgroundColor='#0099cc'"; if (itemType==ListItemType.Item)
{
e.Item.Attributes["onmouseout"]="javascript:this.style.backgroundColor='#FFFFFF'";
} else if(itemType==ListItemType.AlternatingItem)
{
e.Item.Attributes["onmouseout"]="javascript:this.style.backgroundColor='#EFEFEF'";
} if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem)
{
ImageButton button = (ImageButton) e.Item.FindControl("delbutton");
button.Attributes.Add ("onclick","return confirm (\"确定要删除此项记录吗?\");");
}
}
解决方案 »
- DropDownList怎么绑定IList
- 关于gnome源码下载方式,请教
- asp.net 调用了DLL库,在*.aspx.cs 指定调用位置,用IIS 发布到服务器上出现问题
- 我所想的按钮防刷新,以前倒是知道跳转到另外一个页面,有跳转回来即可解决,但不能弹出窗口提示,今天想到的这个有弹出窗口提示,所以分享一下。
- 如何校验GridView的编辑列内容
- VS2005生成的时候错误,大家帮忙看看是什么问题?
- 时间问题!
- 如何读取客户端ip代理服务器的名字,在线等待
- 如何区分绑定的列中数据库表不同而字段相同的问题?
- 求助各位老司机,下面功能室用的什么插件
- 遇到问题了,请大家帮帮我???
- DataGrid问题
一点问题都没有
如果要用GridView的话
还是要改的
http://gridviewguy.com/ArticleDetails.aspx?articleID=172
Changing GridView Row Color OnMouseOver确认删除的话,只要把按钮列改称模板列,在OnClientClick中加入js就ok了。
{
e.Row.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#0099cc'";
if (e.Row.RowType == DataControlRowType.DataRow)
{ if (e.Row.RowState == DataControlRowState.Alternate) e.Row.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#E0E0E0'";
else
e.Row.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#FFFFFF'"; LinkButton button = (LinkButton)e.Row.FindControl("LinkButton1");
button.Attributes.Add("onclick", "return confirm (\"确定要删除?\");"); }
}