jQuery Change Image on Mouseover or Change Image Src (Source) on Mouse Over not bind Image

Posted by Shail under JavaScript on 5/22/2014 | Points: 10 | Views : 1807 | Status : [Member] | Replies : 1

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>

<script type="text/javascript">

$(function () {

$("#imgdetails").hover(function () {

$(this).attr("src", '<%# "./Admin/BImage/"+Eval("P_BImage") %>');

}, function () {

$(this).attr("src", '<%# "./Admin/FImage/"+Eval("P_FImage") %>');






<asp:DataList ID="dlLatestProduct" runat="server" RepeatColumns="3" Width="100%"



<div class="prod_box">

<div class="top_prod_box"></div>

<div class="center_prod_box">

<div class="product_title"><a href="#"><%#Eval("P_Name") %></a></div>

<div><a href="#">

<img id="imgdetails" src='<%# "./Admin/FImage/"+Eval("P_FImage") %>' alt="" border="0" width="80" height="80"/>

<div class="prod_price"><span class="reduce"><%#Eval("P_Price") %></span> <span class="price"><%#Eval("P_Price") %>INR</span></div>


<div class="bottom_prod_box"></div>

<div class="prod_details_tab"> <a href="#" title="header=[Add to cart] body=[&nbsp;] fade=[on]"><img src="images/cart.gif" alt="" border="0" class="left_bt" /></a> <a href="#" title="header=[Specials] body=[&nbsp;] fade=[on]"><img src="images/favs.gif" alt="" border="0" class="left_bt" /></a> <a href="#" title="header=[Gifts] body=[&nbsp;] fade=[on]"><img src="images/favorites.gif" alt="" border="0" class="left_bt" /></a> <a href="details.html" class="prod_details">details</a> </div>





and my cs.code is

private void bindlatestProduct()


bal.Action = "SelectProduct";

DataTable dt = new DataTable();

dt = bal.BalBind();

dlLatestProduct.DataSource = dt;



image not bind dynamically plz check my code
plz help me


Posted by: Kumaran on: 5/23/2014 [Member] Starter | Points: 25

$(this).attr("src", '<%# "./Admin/BImage/"+Eval("P_BImage") %>'); instead of

$(this).attr("src", '../Admin/BImage/img name'); use this

its working for me

Shail, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response