Hi guys,
I have a Gridview that uses this method as the data source:
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)]
public EntityCollection<EventEntity> GetBySearch()
{
EntityCollection<EventEntity> output = new EntityCollection<EventEntity>();
IRelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.Relations.Add(EventEntity.Relations.LookupCodeEntityUsingLocationId, "Location");
bucket.Relations.Add(EventEntity.Relations.LookupCodeEntityUsingEventTypeId, "EventType");
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.FetchEntityCollection(output, bucket, 0);
}
return output;
}
I'm not sure if its equivalent to this SQL with regards to the Lookup table(s) relations:
SELECT dbo.Event.EventId, dbo.Event.LocationId, Location.CodeValue AS Location, dbo.Event.EventTypeId, EventType.CodeValue AS EventType,
dbo.Event.EventDescription, dbo.Event.EventDate, dbo.Event.ProviderName, dbo.Event.EventStatusId
FROM dbo.Event INNER JOIN
dbo.LookupCode AS Location ON dbo.Event.LocationId = Location.LookupCodeId INNER JOIN
dbo.LookupCode AS EventType ON dbo.Event.EventTypeId = EventType.LookupCodeId
In the Grid Columns i have something like this to bind the values:
<telerik:GridBoundColumn HtmlEncode="true" DataField="EventType.CodeValue" SortExpression="EventType" HeaderText="Event Type"/>
<telerik:GridBoundColumn HtmlEncode="true" DataField="Location.CodeValue" SortExpression="Location" HeaderText="Location"/>
The gridview works and displays data but i'm the "CodeValue" column is empty. I'm not sure if i'm defining the "DataField" incorrectly in the gridview or if i'm missing a step in the "GetBySearch" method. Please advise.
Thanks in Advance,
John