Unable to Insert Into Database asp.net Using C# - Unhandled Exception
<p>I am trying to insert user data into a database using an asp.net form created in Microsoft Visual Studio 2015. I am getting the following error:</p>

<blockquote>
  <p>Exception Details: System.Web.HttpException: Unable to find control id
  'txtName' referenced by the 'ControlToValidate' property of 'reqName'.</p>
  
  <p>Source Error: </p>
  
  <p>An unhandled exception was generated during the execution of the
  current web request. Information regarding the origin and location of
  the exception can be identified using the exception stack trace below.</p>
  
  <p>Stack Trace: </p>
  
  <p>[HttpException (0x80004005): Unable to find control id 'txtName'
  referenced by the 'ControlToValidate' property of 'reqName'.]<br>
  System.Web.UI.WebControls.BaseValidator.CheckControlValidationProperty(String
  name, String propertyName) +183<br>
  System.Web.UI.WebControls.BaseValidator.ControlPropertiesValid() +36<br>
  System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e) +36<br>
  System.Web.UI.Control.PreRenderRecursiveInternal() +166<br>
  System.Web.UI.Control.PreRenderRecursiveInternal() +236<br>
  System.Web.UI.Control.PreRenderRecursiveInternal() +236<br>
  System.Web.UI.Control.PreRenderRecursiveInternal() +236<br>
  System.Web.UI.Control.PreRenderRecursiveInternal() +236<br>
  System.Web.UI.Control.PreRenderRecursiveInternal() +236<br>
  System.Web.UI.Page.ProcessRequestMain(Boolean
  includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  +4713</p>
</blockquote>

<p>c# code to insert user data into database:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;


public partial class _Default : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C: \Users\P\Docs\Visual Studio 2015\WebSites\WebSite2\App_Data\Database.mdf;Integrated Security=True");

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        con.Open();
        SqlCommand cmd = con.CreateCommand();
        cmd.CommandType = System.Data.CommandType.Text;
        cmd.CommandText = "insert into Table values('" + pName.Text + "','" + pEmail.Text + "')";
        cmd.ExecuteNonQuery();

        con.Close();
    }
}
</code></pre>

<p>My database file has two rows, one for the name (pName) and the other for the e-mail (pEmail)</p>