Hello,
I am writing an ASP.NET application using javascript.
It uses a modal dialog which has a button.
When pressing the button another window is opened.
I'd like to perform the action on submit without opening a new window.
Here is some code for example:
code for first.aspx:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script language="javascript" type="text/javascript">
function openModal()
{
var returnValue = window.showModalDialog('modal.aspx', 'win','help:no;status:no;scroll:no;resize:no;dialogHeight:198px;dialogWidth:450px');
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<button id="btn" onclick="javascript:openModal()">Open</button>
</div>
</form>
</body>
</html>
code for modal.aspx:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btn" runat="server" Text="click" onclick="btn_Click" />
</div>
</form>
</body>
</html>
code for modal.aspx.cs:
protected void btn_Click(object sender, EventArgs e)
{
Response.Write(DateTime.Now.ToString());
}
How can I prevent the extra window from opening?
Thanks