different window.open opens the same page
<p>I am using window.open to open 2 different pages in pop-up windows,but for some reason both the triggers opens the same page in the pop-up window,heres how I am trying to do this:</p>

<p>first:  </p>

<pre><code>Response.Write("&lt;script type='text/javascript'&gt;window.open('TransEditEntry.aspx','mywindow','width=850px,height=300px,left=0,top=10,screenX=100,screenY=10')&lt;/script&gt;");
</code></pre>

<p>second: </p>

<pre><code>Response.Write(@"&lt;script type='text/javascript'&gt;window.open('TransNewEntry.aspx','','width=850px,height=300px,left=0,top=10,screenX=100,screenY=10')&lt;/script&gt;");
</code></pre>

<p>this opens 'TransEditEntry.aspx' page instead of 'TransNewEntry.aspx'`</p>

<p>here the rest of the code:</p>

<p>The entire function which is called on add button click:</p>

<pre><code>protected void addNew(object sender, EventArgs e)
    {
        //HiddenField sr = (HiddenField)GridView1.SelectedRow.Cells[6].FindControl("srno");
        //Session["TransSrNo"] = sr.Value;
        Response.Write(@"&lt;script type='text/javascript'&gt;window.open('TransNewEntry.aspx','','width=850px,height=300px,left=0,top=10,screenX=100,screenY=10')&lt;/script&gt;");
        //Session["transAdd"] = "1";
    }
</code></pre>

<p>The add button which calls the function:</p>

<pre><code>&lt;asp:Button ID="AddBtn" runat="server"  OnClick="addNew" Text="Add"/&gt;
</code></pre>

<p>The page TransNewEntry.aspx.cs</p>

<pre><code>public partial class TransEditEntry : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection(GetConnectionString.Get());
    string subCode;
    DataTable dt;
    SqlDataAdapter sda;
    SqlCommandBuilder build;
    DataRow dr;
    DataSet ds = new DataSet();

    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write((Session["TransSrNo"]).ToString());
        int SRno = Convert.ToInt32((Session["TransSrNo"]).ToString());
        con.Open();
        SqlCommand cmd3 = new SqlCommand("select sub_code from tran_dtls where sr_no='" + SRno + "'", con);
        subCode = (string)cmd3.ExecuteScalar();

        con.Close();
        if (!IsPostBack)
        {


            sda = new SqlDataAdapter("select * from tran_dtls where sr_no=" + SRno + "", con);
            build = new SqlCommandBuilder(sda);
            dt = new DataTable();
            sda.Fill(dt);
            foreach (DataRow row in dt.Rows)
            {
                srNoTxt.Text = "";
                amttxt.Text = "";
                partTxt.Text = "";
                checkNoTxt.Text = "";
                checkDtTxt.Text = "";
                refNoTxt.Text = "";
                refDtTxt.Text = "";
                jobNoTxt.Text = "";


            }

        }
    }

    protected void GlChange(object sender, EventArgs e)
    {
        con.Open();
        SqlCommand cmd4 = new SqlCommand("select ac_type from ac_mstr where AC_desc='" + GlDrp.SelectedValue + "'", con);
        string acType = (string)cmd4.ExecuteScalar();

        SqlCommand cmd5 = new SqlCommand("select gl_code from ac_mstr where AC_desc='" + GlDrp.SelectedValue + "'", con);
        string gl_code = (string)cmd5.ExecuteScalar();


        if (acType == "S")
        {
            SqlDataSource3.SelectCommand = ("select ac_desc from ac_mstr where gl_code='" + gl_code + "'");
            subDrp.DataBind();
            subDrp.Enabled = true;
            //Response.Write("&lt;script type='javacript/text'&gt;alert('1')&lt;/script&gt;");
        }
        else
        {
            subDrp.Enabled = false;
            //Response.Write("&lt;script type='javacript/text'&gt;alert('2')&lt;/script&gt;");
        }

        con.Close();
    }

    protected void saveRow(object sender, EventArgs e)
    {
        int SRno = Convert.ToInt32((Session["TransSrNo"]).ToString());


        sda = new SqlDataAdapter("select * from tran_dtls where tc='" + Session["TC"] + "' and doc_no='" + Session["docNo"] + "' ", con);
        build = new SqlCommandBuilder(sda);
        //dt = new DataTable();
        // DataSet ds = new DataSet();

        sda.Fill(ds);
        dt = (DataTable)ViewState["myViewState"];
        if (Session["gridRow"] == null)
        {
            dt = ds.Tables[0];


            dr = dt.NewRow();
            dr["GL_code"] = GlDrp.SelectedValue;
            dr["sub_code"] = subDrp.SelectedValue;
            dr["particulars"] = partTxt.Text;
            dr["chq_no"] = checkNoTxt.Text;
            dr["chq_dt"] = checkDtTxt.Text;
            dr["ref_no"] = refNoTxt.Text;
            dr["ref_dt"] = refDtTxt.Text;
            dr["dbcr"] = dbcrDrp.SelectedValue.ToString().Substring(0, 1);
            dr["amt"] = amttxt.Text;
            dr["job_no"] = jobNoTxt.Text;
            dr["EMP"] = empDrop.SelectedValue;
            dt.Rows.Add(dr);
            dt.AcceptChanges();
            ViewState["myViewState"] = dt;
            //Session["gridRow"] = dt;
            Session["gridRow"] = dt;
            Session["saveToggle"] = "1";
            closeFunction();
            Response.Write("&lt;script type='text/javascript'&gt;this.close()&lt;/script&gt;");
        }

        else
        {
            dt = (DataTable)Session["gridRow"];
            dr = dt.NewRow();
            dr["GL_code"] = GlDrp.SelectedValue;
            dr["sub_code"] = subDrp.SelectedValue;
            dr["particulars"] = partTxt.Text;
            dr["chq_no"] = checkNoTxt.Text;
            dr["chq_dt"] = checkDtTxt.Text;
            dr["ref_no"] = refNoTxt.Text;
            dr["ref_dt"] = refDtTxt.Text;
            dr["dbcr"] = dbcrDrp.SelectedValue.ToString().Substring(0, 1);
            dr["amt"] = amttxt.Text;
            dr["job_no"] = jobNoTxt.Text;
            dr["EMP"] = empDrop.SelectedValue;
            dt.Rows.Add(dr);
            dt.AcceptChanges();
            ViewState["myViewState"] = dt;
            //Session["gridRow"] = dt;
            Session["gridRow"] = dt;
            Session["saveToggle"] = "1";
            //Response.Write("&lt;script type='text/javascript'&gt;window.opener.location.reload(true);&lt;/script&gt;");
            closeFunction();
            Response.Write("&lt;script type='text/javascript'&gt;this.close()&lt;/script&gt;");

        }
    }

    private void closeFunction()
    {
        StringBuilder sb = new StringBuilder();
        sb.Append("window.opener.RefreshPage();");
        sb.Append("window.close();");

        ClientScript.RegisterClientScriptBlock(this.GetType(), "CloseWindowScript", sb.ToString(), true);
    }
}
</code></pre>
