title: Telerik Treeview DataBinding
body: <p>I'm having problems data binding multiple tables in one teir of children. So say for instance I have 5 tables.</p>
  
  <pre><code>contracts
  members
  phoneassessments
  homeassessments
  personalassessments
  </code></pre>
  
  <p>Each Assessment table has the referencing MemberID and I need to print all three types of assessments in the tiers directly under Members, in other words to look like this.</p>
  
  <pre><code>Contract 1
      Member 1
          Home Assessment 1
          Home Assessment 2
          Phone Assessment 1
          Personal Assessment 1
          etc
      Member 2
  </code></pre>
  
  <p>The code I have is... </p>
  
  <pre><code>Html.Telerik().TreeView()
     .Name("TreeName")
     .BindTo(Model, mappings =&gt;
       {
         mappings.For&lt;SMTXEFMVCModel.Contract&gt;(binding =&gt; binding
           .ItemDataBound((item, contract) =&gt;
             {
               item.Text = contract.Description;
               item.SpriteCssClasses = ("icon-contracts");
             })
             .Children(Contract =&gt; Contract.Members));
         mappings.For&lt;SMTXEFMVCModel.Member&gt;(binding =&gt; binding
           .ItemDataBound((item, member) =&gt;
             {
               item.Text = member.FirstName + " " + member.LastName;
               item.SpriteCssClasses = ("icon-members");
          }));
       })
      )
  </code></pre>
  
  <p>So my question is, what comes next? What's the syntax?</p>
  
  <p>I can't help but think it will look something like this.</p>
  
  <pre><code>Html.Telerik().TreeView()
     .Name("TreeName")
     .BindTo(Model, mappings =&gt;
       {
         mappings.For&lt;SMTXEFMVCModel.Contract&gt;(binding =&gt; binding
           .ItemDataBound((item, contract) =&gt;
             {
               item.Text = contract.Description;
               item.SpriteCssClasses = ("icon-contracts");
             })
             .Children(Contract =&gt; Contract.Members));
         mappings.For&lt;SMTXEFMVCModel.Member&gt;(binding =&gt; binding
           .ItemDataBound((item, member) =&gt;
             {
               item.Text = member.FirstName + " " + member.LastName;
               item.SpriteCssClasses = ("icon-members");
             {)
             .Children(Members =&gt; Members.Assessments));
          mappings.For&lt;(SMTXEFMVCModel.HomeAssessments,SMTXEFMVCModel.PhoneAssessments,
                        SMTXEFMVCModel.PersonalAssessments)&gt;(binding =&gt; binding
           .ItemDataBound((item, assessments) =&gt;
             {
               item.Text = HomeAssessments.AssessmentID.ToString()
               item.Text = PhoneAssessments.AssessmentID.ToString()
               item.Text = PersonalAssessments.AssessmentID.ToString()
          }));
       })
      )
  </code></pre>
  
  <p>Here's the relevant ActionResult for my controller</p>
  
  <pre><code>  public ActionResult TreeView()
    {
      var ctx = new SMTXContext();
      var Contracts = ctx.Contracts.ToList();
      return View(Contracts);
    }
  </code></pre>
  
  <p>which I use in my view as an IEnumerable to Strongly type the tables from the model.  (The below line is the first line in my view.</p>
  
  <pre><code>@model IEnumerable&lt;SMTXEFMVCModel.Contract&gt;
  </code></pre>