asp.net - EntityDataSource Show Entity Data With It Navigation Properties -


Hello I have an institution which is cold user whose navigation property UsersData One field is "LastLoginDate".

What I want to do, EntityDataSource is used to display some information of users inside GridView (I do not want to back it up with code with linux).

I tried to use the include property of EntityDataSource but I do not know to select the last ligandet field in my gridview Who can use? To do this it is necessary to have a very basic thing, show a relation table field ... this is my code:

  & asp: EntityDataSource ID = "EntityDataSource" runat = "server "ConnectionString =" Name = MyModelEntities "DefaultContainerName =" ModelEntities "EnableDelete =" True "EnableInsert =" True "EnableUpdate =" True "in EntitySetName =" Users "=" UsersData "AutoGenerateWhereClause =" True "EnableFlattening =" False " & Gt; & Lt; / ASP: EntityDataSource & gt;  

If the relation between the user and the user is in 1: 1, then you try Add to your grid field like this:

  & lt; Asp: boundfield datafile = "usersdata.lastLoginDate" header text = "last login" />  

Where the user data is the name of the navigation asset in your user property. Similarly you can try to use eval expression in TemplateField:

  & lt;% # Eval ("UsersData.LastLoginDate")% & gt;  

Comments