Using Alert in Response.Write Function in ASP.NET
<p>I have database code like this </p>

<pre><code>try
{
    string strConnectionString = ConfigurationManager.ConnectionStrings["SqlServerCstr"].ConnectionString;

    SqlConnection myConnection = new SqlConnection(strConnectionString);
    myConnection.Open();

    string hesap = Label1.Text;
    string musteriadi = DropDownList1.SelectedItem.Value;
    string avukat = DropDownList2.SelectedItem.Value;

    SqlCommand cmd = new SqlCommand("INSERT INTO AVUKAT VALUES (@MUSTERI, @AVUKAT, @HESAP)", myConnection);

    cmd.Parameters.AddWithValue("@HESAP", hesap);
    cmd.Parameters.AddWithValue("@MUSTERI", musteriadi);
    cmd.Parameters.AddWithValue("@AVUKAT", avukat);
    cmd.Connection = myConnection;

    SqlDataReader dr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
    Response.Redirect(Request.Url.ToString());
    myConnection.Close();
}
catch (Exception)
{
    Response.Write("&lt;h2&gt;ERROR&lt;/h2&gt;");
}
</code></pre>

<p>It works fine but what I want, in the catch function, is to call the javascript alert function.</p>

<p>I've tried this</p>

<pre><code>Response.Write("&lt;script language=javascript&gt;alert('ERROR');&lt;/script&gt;);
</code></pre>

<p>But there is an error <img src="http://i.stack.imgur.com/eW7g6.jpg" alt="enter image description here"></p>

<p>How can I show error message in <code>javascript</code> <code>alert</code> function?</p>
