I have a relationship where I need multiple joins back to a single table. I have tried to implement this using a relationship with an alias but can't access the Alias table fields in my datagrid.
Here is my code:
RelationCollection relations = new RelationCollection();
relations.Add(PrivateGameEntity.Relations.ArmyEntityUsingArmyId, "Army");
relations.Add(PrivateGameEntity.Relations.ArmyEntityUsingOpponentArmyId, "OpponentArmy");
relations.Add(PrivateGameEntity.Relations.PlayerEntityUsingOpponentPlayerId, "Opponent");
IPredicateExpression privateGameFilter = new PredicateExpression();
privateGameFilter.Add(PrivateGameFields.PlayerId == Request.QueryString["PlayerId"].ToString());
if (gameYearList.SelectedItem == null)
{
privateGameFilter.Add(PrivateGameFields.DatePlayed >= new DateTime(DateTime.Now.Year, 1, 1));
privateGameFilter.Add(PrivateGameFields.DatePlayed <= new DateTime(DateTime.Now.Year, 12, 31));
}
else
{
privateGameFilter.Add(PrivateGameFields.DatePlayed >= new DateTime(Convert.ToInt32(gameYearList.SelectedValue), 1, 1));
privateGameFilter.Add(PrivateGameFields.DatePlayed <= new DateTime(Convert.ToInt32(gameYearList.SelectedValue), 12, 31));
}
e.ContainedCollection.GetMulti(privateGameFilter, relations);
I then try to bind this to my Telerik RadGrid like this:
<Telerik:GridHyperLinkColumn DataTextField="OpponentArmy.ArmyName" DataNavigateUrlFields= "OpponentArmyId"
DataNavigateUrlFormatString= "~/public/armyprofile.aspx?ArmyId={0}" UniqueName="OpponentArmyName"
HeaderText="Opponent Army" SortExpression="OpponentArmyName"></Telerik:GridHyperLinkColumn>
Any help would be appreciated I am new to this product and really struggling.
Thanks