Using orderby with an EntityDataSource

This can be confusing when you are selecting all (*)

In a LinqDataSource if you want to sort by a column called 'item_id' you simply put:
sortyby="item_id"

but if you use that syntax with a EntityDataSource you will get this error:
System.Data.EntitySqlException: 'group_name' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly., near simple identifier

But in an EntityDataSource you will need to do:
sortyby="it.[item_id]"

Notice that it will always be it. That confused me for a while... the problem is that if you are selecting certain items and not using the auto-update, insert or delete features, the orderby dialogue in the GIU is very simple, but when you want to use these features, it mysteriously disappears.
Comments are closed