如何在div asp.net c#中从gridview鼠标悬停成像? [英] How to image on mouseover from gridview in div asp.net c#?

查看:88
本文介绍了如何在div asp.net c#中从gridview鼠标悬停成像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的gridview代码 - :



但它不是鼠标悬停的div。



< asp:TemplateField>

< HeaderTemplate> PictureUrl< / HeaderTemplate>

< itemtemplate>

< asp:Image ImageUrl ='<%#Eval(FileUrl)%>'

ID =ImagePictureWidth =30Height =30onmouseout =this.style.width = '30px'; this.style.height = '30px';的onmouseover =this.style.width = 400像素; this.style.height = 300像素; runat =server/>

解决方案

你的问题是什么?请清楚地告诉您的问题..您想在鼠标悬停事件中显示图像吗?

如果这是您的问题,那么您可以处理 rowDataBound事件添加鼠标悬停行的属性并在那里指定你的ImageUrl属性...





在rowDataBound事件中,



  if (e.Row.RowType == DataControlRowType.DataRow)
{
Image img =(Image)e.Row.FindControl( yourImageId);
img.Attributes.Add( onmouseover this.src ='yourUrl');
}


Refre this ..



只需更改工具提示像这样......

 <   div     id   = 工具提示 >  

< 样式 = 颜色:#949494; font-family: Flamenco, 草书; text-transform: 大写 > < / table > < / div >


my gridview code-:

But it's not a div open in mouseover.

<asp:TemplateField>
<HeaderTemplate> PictureUrl </HeaderTemplate>
<itemtemplate>
<asp:Image ImageUrl='<%# Eval("FileUrl") %>'
ID="ImagePicture" Width="30" Height="30" onmouseout="this.style.width='30px';this.style.height='30px';" onmouseover="this.style.width='400px';this.style.height='300px';" runat="server" />

解决方案

What is your issue?? Kindly tell your issue clearly.. You want to show image on mouseover event??
If that is your question, then you can handle rowDataBound Event to add mouseover attributes to the rows and specify your ImageUrl Property there...


In rowDataBound Event,

if (e.Row.RowType == DataControlRowType.DataRow)
{
   Image img = (Image)e.Row.FindControl("yourImageId");
   img.Attributes.Add("onmouseover", "this.src='yourUrl'");
}


Refre this..

Just change tooltip like this..

<div id="tooltip">

<table style="color: #949494; font-family: "Flamenco", cursive; text-transform: uppercase"></table></div>


这篇关于如何在div asp.net c#中从gridview鼠标悬停成像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆