0

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

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by saulat78
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.