ASP.NET C# - Redirect After Inserted Record
<p>I perform and insert new record, this code below works for for inserting. After that, I want to redirect to another page using window.parent.location with the ID (ProposalID) that I used in the insert.</p>

<pre><code>private void ExecuteInsert(string ProposedID, string CreatedBy, string Note)
    {
    SqlConnection conn = new SqlConnection(GetConnectionString());
    string sql = "INSERT INTO MDF_ProposedNote (ProposedID, Note, CreatedBy) 
    VALUES "
                + " (@ProposedID, @Note, @CreatedBy)";

    try
    {

            conn.Open();
        SqlCommand cmd = new SqlCommand(sql, conn);
        SqlParameter[] param = new SqlParameter[3];

        param[0] = new SqlParameter("@ProposedID", SqlDbType.Int, 10);
            param[1] = new SqlParameter("@Note", SqlDbType.VarChar, 2000);
            param[2] = new SqlParameter("@CreatedBy", SqlDbType.Int, 10);

        param[0].Value = ProposedID;
        param[1].Value = Note;
        param[2].Value = CreatedBy;

        for (int i = 0; i &lt; param.Length; i++)
        {
            cmd.Parameters.Add(param[i]);
        }

        cmd.CommandType = CommandType.Text;
        cmd.ExecuteNonQuery();
    }
    catch (System.Data.SqlClient.SqlException ex)
    {
        string msg = "Insert Error:";
        msg += ex.Message;
        throw new Exception(msg);
    }
    finally
    {
        conn.Close();
        Response.Write("&lt;script&gt;window.parent.location = 
        'ProposalItemView.aspx?ProposedID='"&lt;%=ProposedID%&gt;";&lt;/script&gt;");
    }
    }
</code></pre>

<p>This is where I and to redirect to another page + RecordID </p>

<pre><code>Response.Write("&lt;script&gt;window.parent.location = 
'ProposalItemView.aspx?ProposedID='"&lt;%=ProposedID%&gt;";&lt;/script&gt;");
</code></pre>

<p>Please help. Thanks in advance.</p>
