title: MVC 1.0 Ajax.BeginForm() submit inside an Html.BeginForm()
body: <p>I have a View for creating a new account in my application. This view starts with Html.BeginForm() and hits the right controller (Create) no problems. </p>
  
  <p>I decided to add an Ajax.BeginForm() so that I could make sure an account with the same name doesn't already exist in my application. </p>
  
  <p>When I click the submit using either button it goes to the same controller (Create). To try and differentiate which submit button was clicked, I put in a check to see if the request is Ajax then try to run a different code path. But <code>Request.IsAjaxRequest()</code> doesn't fire. What is my best bet to implement this functionality in an existing form with MS Ajax?</p>
  
  <pre><code>&lt;% using (Html.BeginForm()) {%&gt;
             ..............
    &lt;% using(Ajax.BeginForm("Echo", 
       new AjaxOptions() { UpdateTargetId = "EchoTarget" })) 
    { %&gt;    
       Echo the following text: 
    &lt;%=Html.TextBox("echo", null, new { size = 40 })%&gt;
    &lt;input type="submit" value="Echo" /&gt;
    &lt;% } %&gt;   
    &lt;div id="EchoTarget"&gt;
  </code></pre>
  
  <p>controller code:</p>
  
  <pre><code>[AcceptVerbs(HttpVerbs.Post)]
      public ActionResult Create(User newUser)
      {
          if (Request.IsAjaxRequest())
          {
              return Content("*you hit the ajax button");
          }
          else
          { //regular create code here.....
          }
    &lt;/div&gt;
  </code></pre>