Reputation: 305
I want to get the ImageUrl from asp:Image Id="imgIdCard" and set as parameter instead to have a fixed value to load.
NOTE: The value of ImageUrl has been already assigned, that why, althought doesn't appear, already has the value.
This is the HTML code.
<div class="page" >
<div class="box cf">
<div class="left">
<span class="demowrap">
<asp:Image ID="imgIdCard" class="imgClass" runat ="server"/>
</span>
</div>
<div id="dialogEditor">
<div class="images">
<div id="cropzoom_container">
</div>
</div>
</div>
In the source, for now I have a fixed value [source: 'xray-linux.jpg',] but I would like to pass the value of imageUrl of asp Image Id="imgIdCard" instead this fixed value.
<script type="text/javascript">
$(document).ready(function () {
var cropzoom = $('#cropzoom_container').cropzoom({
width: 400,
height: 300,
bgColor: '#CCC',
enableRotation: true,
enableZoom: true,
selector: {
centered: true,
borderColor: 'blue',
borderColorHover: 'yellow'
}
,
image: {
source: 'xray-linux.jpg',
width: 1920,
height: 1450,
minZoom: 10,
maxZoom: 150
}
});
});
Which instruction it's necesary in Jquery to replace next below line and assign this the valu from imageUrl?
source: 'xray-linux.jpg',
Upvotes: 1
Views: 1797
Reputation: 1083
try this -
$("#"+"<%= imgIdCard.ClientID%>").attr("src");
Upvotes: 0
Reputation: 39777
asp:Image
renders as <img>
in HTML and it's ImageUrl
renders as src
. Therefore try in your jQuery code:
source: $("#imgIdCard").attr("src"),
Upvotes: 1