1

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',
Khristian Liahut
  • 195
  • 1
  • 6
  • 24
  • may be this helps you http://stackoverflow.com/questions/8733326/take-url-parameter-value-and-add-it-to-image-source-with-jquery – coder Sep 01 '13 at 16:34
  • possible duplicate of [JQUERY Get ImageUrl from image control to image html inside user control](http://stackoverflow.com/questions/18552605/jquery-get-imageurl-from-image-control-to-image-html-inside-user-control) – Devraj Gadhavi Sep 02 '13 at 11:49

2 Answers2

1

asp:Image renders as <img> in HTML and it's ImageUrl renders as src. Therefore try in your jQuery code:

source: $("#imgIdCard").attr("src"),
Yuriy Galanter
  • 38,833
  • 15
  • 69
  • 136
0

try this -

$("#"+"<%= imgIdCard.ClientID%>").attr("src");
Ravindra Vairagi
  • 1,055
  • 15
  • 22