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 : 2115 | Status : [Member] | Replies : 1
<head>

<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") %>');

});

})

</script>

</head>

<form>

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

RepeatDirection="Vertical">

<ItemTemplate>

<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>

<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>

</div>

</ItemTemplate>

</asp:DataList>

<form>

and my cs.code is

private void bindlatestProduct()

{



bal.Action = "SelectProduct";

DataTable dt = new DataTable();

dt = bal.BalBind();

dlLatestProduct.DataSource = dt;

dlLatestProduct.DataBind();



}

image not bind dynamically plz check my code
plz help me




Responses

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

Up
0
Down
$(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