I spent about 3 hours cursing up a storm over some data binding I was doing using the EntityDataSource against my Entity Framework context. I was feeling lazy and using the declarative data sources to bind against my grid for some automatic operations. So, should be easy right? Slap on the data source, bind to the grid, add the other data source for the lookups and bind that to the column.
So why was my column always showing the wrong value? Hmm….It was always the first value in the list? hmm…So I thought my grid was defective and went down the route of beating it up. The kicker was I could edit the record, and the newly set value would go into the database. It would never reflect on the grid though. This was rediculously annoying.
I finally gave up and created a new data source and ran my own Linq on the context to pull the objects. Thats when the Ah HA! moment came. I typed my INCLUDE off the context to pull the relationships in.
WAIT! You tell me. Wasn’t that on the data source setup wizard screen when you said pick all the properties? NO. No it isn’t. All the relationships are missing as selectable items on that screen. I guess the EntityDataSource is not usable in these scenarios then, right?
Wrong. After banging your head on the wall a few more times, you gingerly go to the properties window of the EntityDataSource object you created. You delicately go to the Include property and type in the name of the property.
What a pile of crap! I spend 3 hours and multiple rewrites to figure out I could have typed the 8 characters in on the property window and been good to go.
Well, it all works now. I just wish that option would have been in the wizard. If I am going the lazy route with declarative bindings, I want to be able to go full lazy.