title: ASP.net Validation Control Interfering With Separate Controls
body: <p>I have a FormView on a page which allows a user to update an entry in the database. The database is defined using a code first approach, several fields are defined as being required. The form view is shown below, the form view works:</p>
  
  <pre><code>&lt;asp:FormView ID="BikeAdd" runat="server"
          ItemType="WLL.DAL.Bike"
          InsertMethod="BikeAdd_InsertItem"
          DefaultMode="Insert"
          RenderOuterTable="false"
          OnItemInserted="BikeAdd_ItemInserted"
          ValidationGroup="BikeForm"
          &gt;
          &lt;InsertItemTemplate&gt;
              &lt;fieldset&gt;
                  &lt;div&gt;
                      &lt;asp:DynamicEntity runat="server" Mode="Insert" /&gt;
                  &lt;/div&gt;
                  &lt;br /&gt;
                  &lt;asp:Button ID="ButtonBikeAdd" runat="server" Text="Insert" CommandName="Insert" /&gt;
              &lt;/fieldset&gt;
          &lt;/InsertItemTemplate&gt;
      &lt;/asp:FormView&gt;
  </code></pre>
  
  <p>On the same page I also have a FileUpload control. Which is shown below:</p>
  
  <pre><code>&lt;asp:FileUpload ID="BikeImgUpload" runat="server" /&gt;
  &lt;asp:Button runat="server" ID="UploadBtn" Text="Upload Image" OnClick="UploadBtn_Click" /&gt;
  </code></pre>
  
  <p>The problem is that, when I attempt to upload a file, by clicking the 'UploadBtn' nothing happens other than the required field validation control being populated; a '*' is displayed beside required fields. The code behind the upload button is shown below:</p>
  
  <pre><code>protected void UploadBtn_Click(object sender, EventArgs e)
      {
          if (BikeImgUpload.HasFile)
          {
              try
              {
                  string location = Path.GetFileName(BikeImgUpload.FileName);
                  BikeImgUpload.SaveAs(Server.MapPath("~/Images/BikeImages") + location);
                  Status.Visible = true;
              }
              catch (Exception ex)
              {
                  Status.Text = "Error:" + ex.Message;
                  Status.Visible = true;
              }
  
          }
      }
  </code></pre>
  
  <p>If anyone has any input on the issue that would be great.</p>