hello friends, can anyone give me a tip, I want to load an image in a FileUpload control which is inside a panel in a ModalPopupExtender, I'm using
a script to view the image before uploading it, but I can not see the preview image, not 'running in modal, anyone know how to fix this
this is my code
<div class="box">
<asp:Image ID="Image1" runat="server" Height="120px" Width="120px" ImageUrl="~/img_sistema/sin_foto.jpg" />
<div class="mask">
<asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
<a id="btnShow" runat="server" href="javascript:void(0)" class="link" title="Cambiar Logo"
onclick="Showpopup()"></a>
</div>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnShowPopup"
PopupControlID="pnlpopup" CancelControlID="btnHide" BackgroundCssClass="modalbackground">
</asp:ModalPopupExtender>
<asp:Panel ID="pnlpopup" runat="server" BackColor="#FFFFFF" Height="205px" Width="400px"
Style="display: none; border: 10px solid groove;">
<div>
<a href="javascript:void(0)" id="btnHide" onclick="Hidepopup()" style="float: right;
background-color: #F7FE2E;">Cerrar</a>
<br />
<asp:Label ID="Label2" runat="server" Text="Cambiar Logo." Style=""></asp:Label>
<br />
<br />
<asp:FileUpload ID="FileUpload1" runat="server" onchange="showimagepreview(this)" />
<br />
<asp:Image ID="imgprvw" runat="server" Width="120px" Height="100px" ImageUrl="~/img_sistema/sin_foto.jpg" />
<br />
<asp:Button ID="Button1" runat="server" Text="Guardar" />
</div>
</asp:Panel>
</div>
script preview image
<script type="text/javascript">
function showimagepreview(input) {
if (input.files && input.files[0]) {
var filerdr = new FileReader();
filerdr.onload = function (e) {
$('#imgprvw').attr('ImageUrl', e.target.result);
}
filerdr.readAsDataURL(input.files[0]);
}
}
</script>
show modal
<script type="text/javascript">
//Function to Hide ModalPopUp
function Hidepopup() {
$find('ModalPopupExtender1').hide();
}
//Function to Show ModalPopUp
function Showpopup() {
$find('ModalPopupExtender1').show();
}
</script>
thanks for all