Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > 网页制作 > 当鼠标放在DataList的任何一行时,如何改变行的颜色
【标  题】:当鼠标放在DataList的任何一行时,如何改变行的颜色
【关键字】:DataList
【来  源】:http://blog.csdn.net/jidayangyang/archive/2006/11/05/1367330.aspx

当鼠标放在DataList的任何一行时,如何改变行的颜色

Your Ad Here

解决方法:

在datagrid的itemdatabound事件里面的item的attributes里面增加onclick事件,简单代码如下:
private void YourDataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item  || e.Item.ItemType == ListItemType.AlternatingItem)
{
//添加自定义属性,当鼠标移过来时设置该行的背景色为"6699ff",并保存原背景色
e.Item.Attributes.Add("onmouseover","currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
//添加自定义属性,当鼠标移走时还原该行的背景色
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=currentcolor");
e.Item.Attributes.Add("style","cursor:hand");
e.Item.Attributes.Add("onclick","javascript:YourScriptFunction()");

使用反射将业务对象绑定到 ASP.NET 窗体控件(修改篇):【上一篇】
关于asp button响应回车键的问题:【下一篇】
【相关文章】
  • Ajax实现DataGrid/DataList动态ToolTip
  • 用table写过了个类似DATALIST的水平重复显示的东东,要用的来看看吧。
  • DataGrid,DataList学习笔记
  • 用PagedDataSource来为DataList分页
  • 做个DataList 可分页的数据源
  • DataList显示ArrayList内容
  • DataList中嵌套DataList的例子
  • 再來一個DataList的ItemTemplate的例子
  • ASP.NET中DataGrid和DataList控件用法比较
  • 关于在DataList中加入删除确认
  • 【随机文章】
  • 如何给税控机清库
  • Send a data stream from ABAP to UNIX named pipe
  • GHOST
  • WebSphere快速入门(35)
  • Fireworks制作环绕文字
  • LA链路分析仪
  • Linux版本号
  • 饶颖日记爆赵忠祥性虐待细节(一)
  • MSN Messenger协议简介--转载
  • MIDP3.0(JSR271)早期规范文件发布
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.