Home > ASP.Net, Javascript > Show image in Gridview on mouseover

Show image in Gridview on mouseover


Hi

try this example to show Image onmouseover where i save image name in database and upload image in

Car_Image folder in root of my website

<script type="text/javascript">   
function get_(div_)
{ 
div_=div_.id+"1"; 
document.getElementById(div_).style.display="block";
}

function get_1(div_)
{ 
div_=div_.id+"1"; 
document.getElementById(div_).style.display="none";
}   

</script>

         
<asp:GridView ID="GridView1" runat="Server" AutoGenerateColumns="False">               
<Columns>                   
<asp:BoundField DataField="Id" HeaderText="Id" />                   
<asp:BoundField DataField="Name" HeaderText="Name" />                   
<asp:TemplateField HeaderText="Description">                       
<ItemTemplate>                           
<asp:Image ID="lnk" runat="server" Height="105px" ImageUrl='<%# Eval("Image", "~/Car_Image/{0}") %>'
                        Width="126px" onmouseover="get_(this);" onmouseout="get_1(this);"  />
<div id="lnk1" runat="server" style="display: none; position: absolute; background-color: #FEFFB3;width: 170px; border:gray">
<p><strong>Car Image</strong></p>                               
<p>                                  
<img src='<%# Eval("Image", "~/Car_Image/{0}") %>' runat="Server" id="A" /></p>                           
</div>                        
</ItemTemplate>                   
</asp:TemplateField>               
</Columns>           
</asp:GridView>

Good Luck

Advertisements
Categories: ASP.Net, Javascript
  1. December 24, 2008 at 10:36 am

    . prada . dior. hermes . armani. dolche. gabbana. emporio. escada. cardin. ysl. puma. tj collection. no one

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: