Click here to Skip to main content
15,892,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need help to make my AddResetReason.aspx page popup when AddReasonButton is clicked. Right now nothing happens.

What I have tried:

Here is the code for AddReasonButton which is on Default page.
C#
<asp:Button ID="AddReasonButton" runat="server" Text="+" Font-Size="10" 
    BackColor="RoyalBlue" ToolTip="Add Reason" ForeColor="White" 
    OnClick="AddRequestor_Click" Height="26px" Width="26px"/>


Here is AddResetReason.aspx page
C#
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddResetReason.aspx.cs" Inherits="FTACaseReseting.PopUps.AddResetReason" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Add Reset Reason</title>
</head>
<body>
    <form id="AddResetReasonForm" runat="server" title="Add Reset Reason">
        <div style="width: 270px; height:160px; margin: 0 auto">
            <table>
                <tr>
                    <td><asp:Label ID="ResetReasonLabel" runat="server" Text="New Rejection Reason:" 
                Font-Size="8.25pt" Height="14px" Width="120px"></asp:Label></td>
                </tr>
                <tr>
                    <td><asp:TextBox ID="ResetReasonTextBox" runat="server" Height="20px" Width="206px"></asp:TextBox></td>
                </tr>
                <tr></tr>
                <tr>
                    <td><asp:Button ID="CancelButton" runat="server" Text="Cancel" 
                BackColor="RoyalBlue" Font-Size="8.25pt" Height="22px" Width="76px" /></td>
                    <td><asp:Button ID="AddResetReasonButton" runat="server" Text="Add" 
                Font-Size="8.25pt" /></td>
                </tr>
            </table>
        </div>
    </form>
</body>
</html>


Here is code behind for AddReasonButton. When it is clicked AddResetReason.aspx page should popup. The code I have is not working and I think it is wrong code.
C#
protected void AddReason_Click(object sender, EventArgs e)
        {
            //AddResetReason popup = new AddResetReason(this);
            //System.Windows.Forms.DialogResult dialogresult = popup.ShowDialog();
            //popup.Dispose();
            int intId = 100;
            string strPopup = "<script language='javascript' ID='script1'>"
                //Passing intid to popup window.
                + "window.open('AddResetReasonForm.aspx?data=" + HttpUtility.UrlEncode(intId.ToString())
                "','new window', 'top=90, left=200, width=300, height=160, dependant=no, location=0, alwaysRaised=no, menubar=no, resizeable=no, scrollbars=n, toolbar=no, status=no, center=yes')"
    + "</script>";
            ScriptManager.RegisterStartupScript((Page)HttpContext.Current.Handler, typeof(Page), "Script1", strPopup, false);
        }
Posted
Updated 30-Dec-19 19:37pm

1 solution

Hi,

I think you should use "iframe". When you click your button, onClick event triggered and you can see opened iframe. You can googling like this "How to open an aspx page in a iframe". If this solution s not work correctly may be this help you;

C#
protected void AddReason_Click(object sender, EventArgs e)
{
    string myPage= "AddResetReason.aspx" ;
    string openedPage= "window.open('" + queryString + "');";
    ClientScript.RegisterStartupScript(this.GetType(), "pop", newWin, true);
}


Nice day.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900