What if you bind a list of Foo to a DevExpress ASPxGridView and each Foo has another object, a Bar, at a getsetter also called Bar? Also, what if you reach out to a property on Bar (the Bar object instance) like so?
<%# Eval("Bar.BarId")%>
Alright, if you want your girlfriend to give you aspirin you should ask her to go into her purse for them. You should not go into her purse yourself to get the aspirin. That's respectful, right? Sidestepping logical boundaries is asking for trouble, no? We should not just ask Foo for Bar's Id because what if Bar is null. I have just fought with a hard-to-troubleshoot error in which an ASPxGridView loaded just fine, but upon column filtering produced this error message which could not be pinpointed in the debugger:
Callback request failed due to an internal server error.
You fix this, you will need to make a getsetter on Foo to call instead of calling out to Bar.BarId. It can hold mechanics to compensate for Bar maybe being null.
No comments:
Post a Comment