Access Email Address from DetailView
<p>I'm trying to access the email address in the <code>DetailsView</code> but getting this error:</p>

<pre class="lang-none prettyprint-override"><code>Null Reference Exception was unhandled by user code
</code></pre>

<p>This is what I have in my code:</p>

<pre><code>TextBox EmailAddress = this.DetailsView1.FindControl("Email") as TextBox;
string myemail = EmailAddress.Text;
System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage();
mailMessage.From = new System.Net.Mail.MailAddress(System.Configuration.ConfigurationManager.AppSettings["fromEmailAddress"]);
mailMessage.To.Add(new System.Net.Mail.MailAddress("myemail")); //ERROR
</code></pre>

<p>So, the code is stopping at this line and getting the error I mentioned:</p>

<pre><code>mailMessage.To.Add(new System.Net.Mail.MailAddress("myemail"));
</code></pre>
