title: ASP.NET MVC 2 validation on dynamic page
body: <p>I have registration wizard on my asp.net mvc 2 application with multiple pages. On the first page I should have basic data form of persons involved in the process. I should have 3 text boxes labeled as First Name, Last Name and Address, and 1 check box with text "Add another person". When user clicks on radio button, new text boxes will appear with new radio button, so we can add multiple persons in the same form. Theoretically, we should be able to insert as many persons as possible. All fields are mandatory, so in the validation summary on the top of the page I should have something like, "Please enter first name of the second person" or something like that. I have DTO class:</p>
  
  <pre><code>public class Person
  {
       public string FullName { get; set; }
       public string LastName { get; set; }
       public string Address{ get; set; }
  }
  </code></pre>
  
  <p>and I suppose that my model for this page should be <code>List&lt;Person&gt;</code> and I would append html for new persons with javascript/jQuery. Please help me here, how should I validate this dynamic page? I can go through this wizard with Save and Back buttons and also, we should be able to unclick any radio button on the page and that particular person should disappear and validator should not catch it anymore. My whole wizard is using server side validation (DataAnnotations) and I don't want to use client validation. Thanks in advance.</p>
  
  <p>UPDATE:</p>
  
  <p>I need some more help. I want to extend Person class with new property: </p>
  
  <pre><code>public int Percent { get; set; } 
  </code></pre>
  
  <p>and I want server validation upon submit if sum of all Percents in each of Persons in the <code>IEnumerable&lt;Person&gt;</code> is equal to 100. Can I create custom attribute for this and how? My model is generic List, I can't apply <code>[CustomAttribute]</code> on it, right?<br>
  Also, I should have validation summary on the top of the page, not right after each of the inputs. I have put : <code>&lt;%:Html.ValidationSummary(false, "Please correct the following and resubmit the page:")%&gt;</code> Is there a way to set different validation message for each of the Persons? Thanks</p>