datagrid中显示图片?? 在datagrid中有一列是图片,有没有办法让鼠标移动到图片上时让原来的图片改换成另外一张图片,也就是说在itemdatabound中给那列加个onmouseover事件,可是我这样做了总不能成功,请大家帮我看看有没有好的办法,谢谢。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以.e.Item.Cells[2].Attributes.Add("onmouseover","this.firstChild.src='b.jpg'");e.Item.Cells[2].Attributes.Add("onmouseout","this.firstChild.src='a.jpg'"); 在模板列中写.<a href='bb.asp'><img src="<%#DataBinder.Eval(Container.DataItem,"url")%>" ></a> 此时脚本要改一下.this.firstChild==>this.firstChild.firstChild 在图片外加一个<a runat="server" id="aa">你的图片</a>给aa的href值,应该可以的吧,或用图片链接控件个人见解,共同学习 <asp:TemplateColumn HeaderText="View"> <ItemTemplate></ItemTemplate></asp:TemplateColumn>模版列像上面那样写的,可以e.Item.Cells[6].Attributes.Add("onmouseover","this.style.background='Black'"); e.Item.Cells[6].Attributes.Add("onmouseout","this.style.background='Red'");来改变背景色,可是没法e.Item.Cells[6].Attributes.Add("onmouseover","this.firstChild.src='view_on.jpg'");e.Item.Cells[6].Attributes.Add("onmouseout","this.firstChild.src='view.jpg'");这样改变图片,如果给模版列加<a href='strUrl'><img src="<%#strImg%>" ></a>又不知道怎么改变图片和连接地址,因为连接地址是不一样,而且要在鼠标放上去和移开的时候显示不同的图片,不知道怎么做了,请大家帮忙看看,谢谢。 function change( obj ){ obj.background = "view_on.gif";}e.Item.Cells[6].Attributes.Add("onmouseover","change( this )");可以在aspx页面中检测到传过来的obj是一个htmltablecell,可是obj.background = "view_on.gif";赋值为什么不起作用呢,谢谢 <asp:TemplateColumn HeaderText="View"> <ItemTemplate></ItemTemplate></asp:TemplateColumn>模版列像上面那样写的=======里面怎么没有图片? 如果原来是空的话应该这样写Add("onmouseover","this.innerHTML='<img src=\'aa.jpg\'>'"); 你要写在ItemCreate事件或者ItemDataBand事件中。。楼上的几位的方法肯定可以实现你的要求 Click the link to solve your problem.Good luck! sql查询语句的问题 大侠求解:关于动态生成控件及其事件的处理方法 大虾们,帮小弟个忙吧,帮我做几道ASP的选择题行么?急用,万分感激!! 安装VS2008中文版遇到的解压问题 【高分】水晶报表中CrystalReportViewer1如何打印啊? 如何用 crystal report 在 asp.net 下運行報表,在線等待 关于数据库连接的问题 简单的难题 请帮我写一段下面的sql语句(绝对给分) 请问运用asp.net可以直接实现WEB的Email收发吗? !!如何用VS2005实现压缩和解压缩?????????? aps.net +orcle 数据库连接问题点
e.Item.Cells[2].Attributes.Add("onmouseout","this.firstChild.src='a.jpg'");
this.firstChild.firstChild
给aa的href值,应该可以的吧,或用图片链接控件个人见解,共同学习
</ItemTemplate>
</asp:TemplateColumn>
模版列像上面那样写的,可以e.Item.Cells[6].Attributes.Add("onmouseover","this.style.background='Black'");
e.Item.Cells[6].Attributes.Add("onmouseout","this.style.background='Red'");
来改变背景色,可是没法e.Item.Cells[6].Attributes.Add("onmouseover","this.firstChild.src='view_on.jpg'");
e.Item.Cells[6].Attributes.Add("onmouseout","this.firstChild.src='view.jpg'");
这样改变图片,如果给模版列加<a href='strUrl'><img src="<%#strImg%>" ></a>又不知道怎么改变图片和连接地址,因为连接地址是不一样,而且要在鼠标放上去和移开的时候显示不同的图片,不知道怎么做了,请大家帮忙看看,谢谢。
{
obj.background = "view_on.gif";
}
e.Item.Cells[6].Attributes.Add("onmouseover","change( this )");
可以在aspx页面中检测到传过来的obj是一个htmltablecell,可是obj.background = "view_on.gif";赋值为什么不起作用呢,谢谢
</ItemTemplate>
</asp:TemplateColumn>
模版列像上面那样写的
=======
里面怎么没有图片?
Add("onmouseover","this.innerHTML='<img src=\'aa.jpg\'>'");
或者ItemDataBand事件中。。楼上的几位的方法肯定可以实现你的要求