Note that there are some explanatory texts on larger screens.

plurals
  1. POOn ASP.NET form submit it throws an Object reference not set to an instance of an object.
    primarykey
    data
    text
    <p>I have a simple email form written in ASP.NET with the logic in the codebehind file. It's all in C# (the logic that is...). Anyways, on page load I have the following:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { RequestorName.Text = Request.Form["UserName"].ToString(); RequestorTitle.Text = Request.Form["JobTitle"].ToString(); RequestorEmail.Text = Request.Form["Email"].ToString(); RequestorPhone.Text = Request.Form["Phone"].ToString(); RequestorAddress1.Text = Request.Form["Address"].ToString(); RequestorAddress2.Text = Request.Form["City"].ToString() + " " + Request.Form["State"].ToString() + ", " + Request.Form["Zip"].ToString(); } </code></pre> <p>This works great as it pulls the users information into a few fields so they don't have to fill everything out by hand.</p> <p>My other 2 methods in the code behind:</p> <pre><code>protected void SubmitForm_Click(object sender, EventArgs e) { SendEmail(); } protected void SendEmail() { try { //compose email and send } catch (Exception ex) { ErrorMessage.Text = "Error: " + ex.ToString(); } } </code></pre> <p>On my form page the button code is this:</p> <pre><code>&lt;center&gt; &lt;asp:Button runat="server" Text="Submit" ID="Submit" OnClick="SubmitForm_Click" class="button red" /&gt; &lt;/center&gt; </code></pre> <p>The error occurs when I click the send button on the form that generates the email and sends it. I can remove the Page_Load code and works great but I'd like to keep it there so the user doesn't have to fill out as much information.</p> <p>I've used my Google Fu and read a ton of threads/articles but can't seem to find the solution...</p> <p>Thanks for any assistance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload