Show data relationship in gridview with dropdownlist or similar?
Posted
by Anders Svensson
on Stack Overflow
See other posts from Stack Overflow
or by Anders Svensson
Published on 2010-05-24T18:46:48Z
Indexed on
2010/05/24
18:51 UTC
Read the original article
Hit count: 189
I have data coming from two tables with a foreign key relationship - one User table containing users of the web application, and one Page table containing details about pages visited by each user.
I would like to be able to view these data in a gridview or the like on a page. It's easy enough to just show the User table data like so (I'm using the Entity Framework and LINQ):
UserDBEntities context = new UserDBEntities();
GridView1.DataSource = from user in context.UserSet
select new { user.Ip, user.Count, user.Description, user.Referer };
GridView1.DataBind();
But how can I show the Page details? I'm not bent on any particular way of showing it, but the only idea I've been able to come up with is to have a dropdown list for each user in a column. But I can't figure out how to get the page data into such a dropdown list. The tables are associated with the primary/foreign key UserID.
Any ideas would be welcome (dropdownlist solution or other)!
© Stack Overflow or respective owner