I've been struggling with this problem for over day. While I have figured out a workaround, I wonder if anyone can explain whether there is a better way to handle it.
I have a RadGrid that is bound to a DomainDataSource. The DomainDataSource is linked to a service (LinqToEntitiesDomainService<T>) and specifically to a function in the service that returns IQueryable<Computer>, where "Computer" is an entity in our application.
In testing, I found that when the service query returned one or more "Computers", RadGrid behaves fine. However, the query function was coded (in C#) to return null when no "Computers" matched certain criteria. In this case, RadGrid did not behave as I expected. The RadGrid control would either appear as a single horizontal borderline on my page (i.e., it apparently collapses to zero height). If I set a fixed height on the control, it would then appear as an empty box. I *thought* RadGrid was supposed to display my NoRecordsTemplate when the dataset was empty OR null.
My workaround (discovered by accident) was to change the service function so it returns a deliberately empty query. Lo and behold, now RadGrid displays my NoRecordsTemplate exactly as intended!
What's the deal with RadGrid and a null (not empty) dataset? Is this expected behavior? If so, how did I miss that in the documentation?
I am not particularly happy about fiddling with the service function logic. I wonder if there is another workaround I can make to handle a null dataset? For instance, can I handle one of the RadGrid events and substitute an empty collection of some sort?
Thanks for any insights.
Jeff
I have a RadGrid that is bound to a DomainDataSource. The DomainDataSource is linked to a service (LinqToEntitiesDomainService<T>) and specifically to a function in the service that returns IQueryable<Computer>, where "Computer" is an entity in our application.
In testing, I found that when the service query returned one or more "Computers", RadGrid behaves fine. However, the query function was coded (in C#) to return null when no "Computers" matched certain criteria. In this case, RadGrid did not behave as I expected. The RadGrid control would either appear as a single horizontal borderline on my page (i.e., it apparently collapses to zero height). If I set a fixed height on the control, it would then appear as an empty box. I *thought* RadGrid was supposed to display my NoRecordsTemplate when the dataset was empty OR null.
My workaround (discovered by accident) was to change the service function so it returns a deliberately empty query. Lo and behold, now RadGrid displays my NoRecordsTemplate exactly as intended!
What's the deal with RadGrid and a null (not empty) dataset? Is this expected behavior? If so, how did I miss that in the documentation?
I am not particularly happy about fiddling with the service function logic. I wonder if there is another workaround I can make to handle a null dataset? For instance, can I handle one of the RadGrid events and substitute an empty collection of some sort?
Thanks for any insights.
Jeff