You cannot use
MessageBox result in Asp.net, it shall be replaced by
confirm() function [
^] in javascript, provided you will have to take care of your business logic and knowing how
Asp page life cycle[
^] works
Mark up
<asp:Button ID="Button1" OnClientClick="funCheck()" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:HiddenField ID="HiddenField1" runat="server" />
Javascript
function funCheck() {
var flag = confirm('The File is Already exist , Do you want to replace it?');
var hdnfld = document.getElementById('<%= HiddenField1.ClientID %>');
hdnfld.value = flag ? '1' : '0';
}
Code behind
protected void Button1_Click(object sender, EventArgs e)
{
if (HiddenField1.Value == "1")
{
}
else
{
}
}