Hi nedash,
Please refer the below code and modify as per your requirement.
<form id="form1" runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/blitzer/jquery-ui.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
$("[id*=btnUpload]").removeAttr("onclick");
$("#dialog").dialog({
modal: true,
autoOpen: false,
title: "User Picture",
width: 350,
height: 260,
buttons: [
{
id: "Yes",
text: "Yes",
click: function () {
$("[id*=btnUpload]").attr("rel", "Upload");
$("[id*=btnUpload]").click();
}
},
{
id: "No",
text: "No",
click: function () {
$(this).dialog('close');
}
}
]
});
$("[id*=btnUpload]").click(function () {
if ($(this).attr("rel") != "Upload") {
$('#dialog').dialog('open');
return false;
} else {
__doPostBack(this.name, '');
}
});
});
</script>
<asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="UploadRecord" UseSubmitBehavior="false" />
<div id="dialog" style="display: none" align="center">
<asp:ImageButton ID="imgbutton" ImageUrl="http://www.aspforums.net/Avatars/UserImage.png"
runat="server" />
<br />
<asp:FileUpload ID="UserPic" runat="server" />
</div>
</form>
C#
protected void UploadRecord(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Picture Uploaded.')", true);
}
Vb.net
Protected Sub UploadRecord(sender As Object, e As EventArgs)
ClientScript.RegisterStartupScript(Me.[GetType](), "alert", "alert('Picture Uploaded.')", True)
End Sub