0

このセットアップは「機能するはず」なので、小さな間違いを犯しているに違いありませんが、送信をクリックしてもデバッグでコントローラーがヒットしません。

HTML

@using (Html.BeginForm("sendMail", "LakerLegends", FormMethod.Post))
{
<table>
  <tr>
    <th class="col-xs-9">
      Name
      <br />
      <input name="name" type="text" required />
      <br />
      Email
      <br />
      <input name="email" type="text" required />
      <br />
      Category
      <br />
      <select name="category" style="font-size: 18px; padding: 0px" required>
        <option value="0">General</option>
        <option value="1">Teams</option>
        <option value="2">Events</option>
        <option value="3">Website</option>
        <option value="4">Internal</option>
      </select>
      <br />
      Details
      <br />
      <textarea name="details" cols="25" required></textarea>
      <br />
      <input type="submit" value="Save" class="form-group" />
      <br />
      <i>An officer will contact you within the next 24 hours.</i>
    </th>
    <th colspan="1">
      <img src="/Content/img/contactIcon.png" style="opacity:.7" />
    </th>
  </tr>
</table>
}

コントローラ

[HttpPost]
   public ActionResult sendMail(string name, string email, string category, string details)
   {
      try
      {
         return RedirectToAction("Index");
      }
      catch (Exception)
      {
         // Some code
      }
         return RedirectToAction("Index");
   }

送信をクリックすると、ページがリロードされるようです。

4

1 に答える 1