eSafetyEntities db = new eSafetyEntities();
var cat = from c in db.Categories
orderby c.CategoryId
select c; /*{c.Categories1, c.Categories2, c.CategoryId, c.CatName}.ToString();*/
// out put the top category menu
foreach (Categories c in cat)
{
c.Categories2Reference.Load();
c.Categories1.Load();
if ( c.Categories2.CategoryId != null)
{
testLbl.Text += c.Categories2.CategoryId + " ";
}
}
|