title: Throw new ArgumentException
body: <p>In my code, how can i make it possible to show a alert box popping out ? i tried to replay throws new argument exception and add in                                                                        Response.Write("alert('NOT Successful');");
  but it shows that i have syntax error near")". Please help me if you know .thanks in an advance .</p>
  
  <pre><code>   if (!IsPostBack)
      {
  
          if (Page.Request.QueryString["hasProducts"].Equals("true"))
          {
              ArrayList al = Session["SelectedProducts"] as ArrayList;
  
              if (al == null)            
                 throw new ArgumentException("A product list is required.");
  
  
              if (al.Count &lt; 1)           
                  throw new ArgumentException("No products selected");
  
  
              string inStatement = string.Empty;
              int len = al.Count;
              int count = 1;
              foreach (string item in al)
              {
                  inStatement = inStatement + "'" + item + "'";
                  if (count &lt; len) { inStatement = inStatement + ","; }
                  count++;
                  //List&lt;string&gt; list = new ArrayList&lt;string&gt;(item.Split(','));
  
                  //item.Split(',');
              }
              //List&lt;String&gt; list = new ArrayList&lt;String&gt;(al.split(","));
              // inStatement = inStatement.Substring(0, inStatement.Length - 2);
  
              //Product aProd = new Product();
              SqlConnection con = new SqlConnection(strcon);
              SqlCommand cmd = new SqlCommand("SELECT * FROM Products WHERE Product_ID in (" + inStatement + ")", con);
              SqlDataAdapter adp = new SqlDataAdapter(cmd);
              DataSet ds = new DataSet();
  
              con.Open();
              adp.Fill(ds, "Products");
              cmd.ExecuteNonQuery();
              con.Close();
            //  GridView1.DataSource = ds;
              //GridView1.DataBind(); 
              DataList1.DataSource = ds;
              DataList1.DataBind();
  
          }
      }
  </code></pre>