Below code runs a confirmation box with Javascript on Asp.Net.
I need to change the button texts. How can I use Yes or No buttons with this messagebox?
Thanks.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Confirmation</title>
<script type="text/javascript">
function ConfirmOnDelete() {
if (confirm("Some question") == true)
return true;
else
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return ConfirmOnDelete();" OnClick="Button1_Click"/>
</div>
</form>
</body>
</html>
You can't do this with confirm
. There is no way to customize the buttons of the native alert
/confirm
/etc dialogs.
You could make a DOM-based dialog instead, and customize the elements to your liking.