title: Resolve Argument Exception ASP.Net
body: <p>Here is the code where where I am getting the exception.</p>
  <pre><code>protected void AddButton_Click(object sender, EventArgs e)
  {
      if (Page.IsValid)
      {
          int empId = Id++;
          Employees employees = new Employees();
          employees.AddEmployee(new Employee(empId, txtName.Text,              txtEmail.Text, txtMobile.Text, txtLandline.Text, txtWebsite.Text, txtAddress.Text));
          foreach (Employee employee in employees.GetList())
          {
              if (employee.Name.Equals(txtName.Text))
              {
                  Repeater1.DataSource = employee;
                  Repeater1.DataBind();
              }
          }
      }
      else
      {
          contactsForm.Style.Add(&quot;display&quot;, &quot;block&quot;);
      }
        
  </code></pre>
  <p>It is giving exception</p>
  <blockquote>
  <p>An exception of type 'System.ArgumentException' occurred in
  System.Web.dll but was not handled in user code</p>
  <p>Additional information: An invalid data source is being used for
  Repeater1. A valid data source must implement either IListSource or
  IEnumerable.</p>
  </blockquote>
  <pre><code>public class Employee
  {
      public int Id { get; set; }
      public string Name { get; set; }
      public string Email { get; set; }
      public string MobileNumber { get; set; }
      public string LandLineNumber { get; set; }
      public string Website { get; set; }
      public string Address { get; set; }
      
      public Employee(int id, string name, string email, string mobilenumber, string landlinenumber, string website, string address)
      {
          Id = id;
          Name = name;
          Email = email;
          MobileNumber = &quot;+91 &quot; + mobilenumber;
          LandLineNumber = landlinenumber;
          Website = website;
          Address = address;
      }
  }
  public class Employees
  {
      List&lt;Employee&gt; ListOfEmployee = new List&lt;Employee&gt;();
      public void AddEmployee(Employee employee)
      {
          ListOfEmployee.Add(employee);
      }
      public List&lt;Employee&gt; GetList()
      {
          return ListOfEmployee;
      }
  }
  </code></pre>
  <p>This is the employee class.</p>
  <p>How can I resolve that exception.</p>
  <pre><code>&lt;asp:Repeater ID=&quot;Repeater1&quot; runat=&quot;server&quot;&gt;
      &lt;ItemTemplate&gt;
          &lt;asp:Label ID=&quot;Label1&quot; runat=&quot;server&quot; Text='&lt;%# DataBinder.Eval(Container.DataItem, &quot;Name&quot;) %&gt;'&gt;&lt;/asp:Label&gt;
          &lt;asp:Label ID=&quot;Label2&quot; runat=&quot;server&quot; Text='&lt;%# DataBinder.Eval(Container.DataItem, &quot;Email&quot;) %&gt;'&gt;&lt;/asp:Label&gt;
          &lt;asp:Label ID=&quot;Label3&quot; runat=&quot;server&quot; Text='&lt;%# DataBinder.Eval(Container.DataItem, &quot;MobileNumber&quot;) %&gt;'&gt;&lt;/asp:Label&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:Repeater&gt;
  </code></pre>
  <p>This is the .aspx code</p>