小弟初学在vs.net中用vb.net编写asp.net.
对于这个问题,我在datagrid控件的itemdatabound事件中编程如下,但达不到我想要的效果.
Private Sub dg1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg1.ItemDataBound
'实现鼠标移到那行以不同颜色显示
if (e.Item.ItemType = ListItemType.Item And e.Item.ItemType = ListItemType.AlternatingItem) Then
e.Item.Attributes.Add("onmouseover", "currentcolor = this.style.backgroundcolor;this.style.backgroundcolor ='#ff0033'")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundcolor=currentcolor")
End If
End Sub
请各位帮忙看看!!
对于这个问题,我在datagrid控件的itemdatabound事件中编程如下,但达不到我想要的效果.
Private Sub dg1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg1.ItemDataBound
'实现鼠标移到那行以不同颜色显示
if (e.Item.ItemType = ListItemType.Item And e.Item.ItemType = ListItemType.AlternatingItem) Then
e.Item.Attributes.Add("onmouseover", "currentcolor = this.style.backgroundcolor;this.style.backgroundcolor ='#ff0033'")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundcolor=currentcolor")
End If
End Sub
请各位帮忙看看!!
解决方案 »
- C# 如何在alert里显示一个变量
- 实体类数据源总是刷新不了
- 如何用JavaScript找到 用JavaScript动态添加的控件
- 有谁用过onlinenic.com的域名注册接口吗?
- 区分绑定字段的问题
- 请问CSDN里面都是用XML 是怎么实现的
- 江湖救急,我现在在客户这里,II7下 配置 asp.net 不会
- 110求助 分别放在两个服务器上的网站(网站由两家公司设计,所以表的结构不一样)现在B网站想获取A网站数据库中的某个表,求解决思路!
- 40分求一段JS代码验证图片大小
- Webform中两种输出方式的区别
- 水晶报表11中文版可不可以在VS.net2003下中使用吗?
- 水晶报表10.0或者11中文版哪里可以下载?
就是这样写呀在if ……语句里
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=""" & "#FFFFFF" & """")
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor=""" & "#EFF3F7" & """") 这样有效果呀。
e.Item.Attributes.Add("onmouseover", "currentcolor = this.style.backgroundcolor;this.style.backgroundcolor ='#ff0033';")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundcolor=currentcolor;")
End If
if(e.Item.ItemIndex>=0)
{
string title="鼠标放上时的颜色";
string bgcolor="离开时的颜色";
e.Item.Attributes.Add("onMouseOver","this.style.backgroundColor='"+title+"'; this.style.cursor='hand';");
e.Item.Attributes.Add("onMouseOut","this.style.backgroundColor='"+bgcolor+"';");
}