Click here to Skip to main content
15,910,797 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i am using master page in webpage:

XML
<asp:Content ID="Content1" runat="server"
    contentplaceholderid="ContentPlaceHolder1">


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

    function showimagepreview1(input) {
        if (input.files && input.files[0]) {
            var filerdr = new FileReader();
            filerdr.onload = function (e) {
                $('#Image1').attr('src', e.target.result);
            }
            filerdr.readAsDataURL(input.files[0]);
        }
    }
    </script>

    <div>
        <asp:Image ID="Image1" runat="server" BackColor="#CC0000" BorderStyle="Double" Height="100px" ImageUrl="~/MemberAccount/Images/image1.jpg" Width="87px" />
        <asp:FileUpload ID="FileUpload1" runat="server" onchange="showimagepreview1(this)" />
        &lt;
    </div>

</asp:Content>


not working
without contentplaceholder ,it is workin fine.
that means without master page..but use master page not work
please help me....
Posted
Comments
I guess you have rejected my answer by mistake after accepting it.
In that case, please accept and up-vote.

Thanks,
Tadit

1 solution

Try replacing the below line...
JavaScript
$('#Image1').attr('src', e.target.result);

with
JavaScript
$('#<%= Image1.ClientID %>').attr('src', e.target.result);
 
Share this answer
 
Comments
Member 10506503 5-Jun-14 7:21am    
thanks sir..
Most Welcome buddy. :)

Please accept this answer, if it has helped you in any way.
This will help others to find the answer in one go and you will also be awarded with some points for this action...

Thanks,
Tadit

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900