Hello all,
I have a question that
must have come up before. I have a project that is based on ADO.NET and Entity Framework and I am trying to build a master/details view. Most of it works, but there is a problem I haven't been able to solve:
I need to prepopulate four fields in the details view with information - a task creation date, userID of the creating user, a boolean task flag, and the ID of the related class. Of these, two fields are foreign keys from related (and associated) tables.
The problem arises when I turn D_USER.ID and D_CLASS_SESSION.ID into template fields. In the model.edmx file, these two fields are (of course) navigation properties called D_USER and D_CLASS_SESSION respectively.
When converting these two database fields from databound controls to templateFields, the following properties are added to the respective ItemTemplates:
Code:
Text='<%# Bind("[D_USER.ID]") %>'
Code:
Text='<%# Bind("[D_CLASS_SESSION.ID]") %>'
When called, the following error is generated as the value of the property is truncated at the period:
DataBinding: '[D_CLASS_SESSION' is not a valid indexed expression.
I've found postings that recommend removing the square brackets ('[' & ']') from the statement, but that seems to break the item's connection to the database, as it causes an error on inserting or editing.
Given the nature of the entity framework, it seems to me that all navigation properties would have similar problem when used in this manner.
how do I correct this?
Thanks,
Les Berg