title: Accessing info from FK-related tables with LINQ
body: <p>I am working on an employee-scheduling system. I think I have the database setup pretty well, and have run into a snag on pulling the data for my database and getting it onto the page. I am using LINQ to make things easy on myself.</p>
  
  <p><a href="https://imgur.com/HyBT.png" rel="nofollow noreferrer">Here</a> is the Object Relational Map.</p>
  
  <p>Here is my Linq select statement:</p>
  
  <pre><code>protected void LinqSelecting(object sender, LinqDataSourceSelectEventArgs e) {
      MilhouseDataClassesDataContext mdb = new MilhouseDataClassesDataContext();
      e.Result = from x in mdb.MilhouseHours
                 group x by x.HourString into hour
                 select new {
                     hourStr=hour.Key,
                     uName=hour};
   }
  </code></pre>
  
  <p>Here are the pertinent parts of my GridView code:</p>
  
  <pre><code>        &lt;asp:GridView ID="GridView1" runat="server" DataSourceID="LinqDataSource1" AutoGenerateColumns="false"&gt;
              &lt;asp:TemplateField HeaderText="Sunday"&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:CheckBoxList ID="shiftsSun" runat="server" DataSource='&lt;%#Eval("uName")%&gt;' DataValueField="UserId" /&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
              ...
          &lt;/asp:Gridview&gt;
  </code></pre>
  
  <p>This will correctly display the UserId from the database, but I want it to display the UserName. The only method I've gotten to have this display work is by changing my group statement to:</p>
  
  <pre><code>group x.aspnet_User by x.HourString into hour
  </code></pre>
  
  <p>I think I'm missing a big concept here. By using group, I should have access to the aspnet_user class members via the uName member of my anonymous class...or so I thought!</p>
  
  <p>edit: Here are a couple screenshots of the variables captured while debugging.</p>
  
  <p><a href="https://imgur.com/I5J4.png" rel="nofollow noreferrer">e.Result</a> | <a href="https://imgur.com/I5Hi.png" rel="nofollow noreferrer">aspnet_User</a></p>
  
  <p>My end goal is to have a gridview which will show a list of work shifts for x hour of y day in each cell. Any design or code help would be greatly appreciated. I can't seem to get my head around this.</p>