Last post Mar 29, 2011 11:09 AM by Blastdan
Mar 24, 2011 01:48 PM|Lee_Ann|LINK
I'd like my foreign key field templates to be autocomplete on edit. The users have asked for the ability to type their selections because the dropdowns take too long but I think they might come in handy sometimes so I don't want to completely eliminate
the dropdown. I found Steve's sample for an advanced field template (http://csharpbits.notaclue.net/2008/07/dynamic-data-and-field-templates_28.html) but he makes
it clear that it doesn't work with foreign keys. So how can I use autocomplete on my foreign key columns or is there a different method that will work better to give my users what they want? I am using DD 4.
Mar 24, 2011 03:37 PM|sjnaughton|LINK
Hi Lee, I deliberaly change it to work with Text field, if you email me directly I can send you a .Net 4 Autocomplete field template.
Mar 29, 2011 10:28 AM|Blastdan|LINK
Im struggling turning this field template into something the EF can work with.
return queryable.Cast<object>().Select(row => CreateAutoCompleteItem(table, row)).ToArray();
That line in the AutoCompleteFilter doesnt work. The error i get is
LINQ to Entities only supports casting Entity Data Model primitive types.
Mar 29, 2011 11:09 AM|Blastdan|LINK
Replaced the Line with
var values = new List<String>();
foreach (var row in queryable)
values.Add( CreateAutoCompleteItem(table, row));