Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
860
[12.1] NullReferenceException on Columns.Clear() when collection is empty
posted

Hello,

I'm playing with NetAdvantage 12.1.20121.1005. One thing which was no problem in the latest 11.2 release throws an exception now:

I have a WebHierarchicalDataGrid, building its columns in code behind. Before I add columns to the column collection I want to make shure that the collection is empty:

DlgSelectedItemsHDG.Columns.Clear();

If the collection is already empty this line throws a NullReferenceException ("Object reference not set to an instance of an object") which it did not in release 11.2. Using

if (DlgSelectedItemsHDG.Columns.Count > 0) DlgSelectedItemsHDG.Columns.Clear();

works as expected. Imho this a bug, since emptying an already empty collection should be possible.