ASP.NET Alert box from Class
<p>I'm using a class "Service" to connect to a DB and return a DataTable to my ASP.NET page.</p>

<p>I'm using try/catch to catch SqlExceptions. I want to display the exception text to the user in an Alert box. How do I do this?</p>

<p>This is my function in Service.class:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace Classes
{
    public class Service
    {
        private static DataTable getDataTable(string query)
        {
            DataTable dt = null;
            SqlConnection con = Dao.getConnection();
            if (Dao.checkConnection())
            {
                SqlDataAdapter da = new SqlDataAdapter(query, con);
                dt = new DataTable();
                try
                {
                    da.Fill(dt);
                }
                catch (SqlException ex)
                {
                //MessageBox.Show(ex.Message);
                Response.Write("&lt;script&gt;alert('This is Alert');&lt;/script&gt;");
                //HttpContext.Current.Response.Write();
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), " ","alert('ERROR')", true);
                //var clientScript = Page.ClientScript;
                //clientScript.RegisterClientScriptBlock(null, "AlertScript", "alert('ERROR')'", true);
                //System.Diagnostics.Debug.WriteLine("Database error: " + ex.Message);
            }
        }
        return dt;
    }
</code></pre>

<p>The compiler gives me this: 
    The name 'Response' does not exist in the current context.</p>

<p>I guess it's pretty basic, just haven't been able to find the answer yet.
The commented stuff is what I tried so far!</p>
