title: Pass and loop Strongly Types Data List to WebForm
body: <p>I am coming from MVC background where I can pass the model data list from controller to view more in structure manner. I need to now how I can pass storgly typed model data from C# class to page.</p>
  
  <p>I am using ASP.NET 3.5</p>
  
  <h2>Model Class</h2>
  
  <pre><code>  public class RolesModel
  {
      public RolesModel() { }
  
      public long RoleID { get; set; }
  
      public string Title { get; set; }
  
      public string Description { get; set; }
  
      public DateTime CreatedDate { get; set; }
  }
  </code></pre>
  
  <p>I have managed to bring list data in aspx.cs class... how I can loop form data in aspx page???</p>
  
  <h2>Roles.aspx.cs class</h2>
  
  <pre><code>  protected void Page_Load(object sender, EventArgs e)
      {
          List&lt;RolesModel&gt; roleList = new List&lt;RolesModel&gt;();
  
          roleList = RoleDefinationRelay.GetAllRoles(null);
  
      }
  </code></pre>
  
  <h2>aspx</h2>
  
  <pre><code>&lt;table&gt;
                         &lt;thead&gt;
                             &lt;tr&gt;
                                 &lt;td&gt;Role ID&lt;/td&gt;
                                 &lt;td&gt;Title&lt;/td&gt;
                                 &lt;td&gt;Description&lt;/td&gt;
                                 &lt;td&gt;Created Date&lt;/td&gt;
                             &lt;/tr&gt;
                         &lt;/thead&gt;
                         &lt;tbody&gt;
                             &lt;tr&gt;
                                &lt;%foreach(var item in  %&gt;???????????
                             &lt;/tr&gt;
                         &lt;/tbody&gt;
                     &lt;/table&gt;
  </code></pre>