User-1876416927 posted
http://forums.asp.net/t/1673340.aspx?Override+PopulateListControl+in+ForeignKey_Edit+field+template
protected new void PopulateListControl(ListControl listControl)
{
var query = Column.Table.GetQuery();
// row
var entityParam = Expression.Parameter(Column.Table.EntityType, "row");
// row => row.DataSourceID
var columnLambda = Expression.Lambda(Expression.Property(entityParam, Column.EntityTypeProperty), entityParam);
// Items.Select(row => row.DataSourceID)
var selectCall = Expression.Call(typeof(Queryable), "Select", new Type[] { query.ElementType, columnLambda.Body.Type }, query.Expression, columnLambda);
// Items.Select(row => row.DataSourceID).Distinct
var distinctCall = Expression.Call(typeof(Queryable), "Distinct", new Type[] { Column.EntityTypeProperty.PropertyType }, selectCall);
var result = query.Provider.CreateQuery(distinctCall);
Having used the code from here to populate my dropdown list I find that only values already in the parent table are being displayed in the select list. I am new to "Expressions" how is it possible to unlink it from the parent table and display all
values. I imagine it's trivial but , as i say, I'm a bear of little brain.