This is a migrated thread and some comments may be shown as answers.

NullReferenceException in RadGrid.DescribeProperties when data for ClientKeyDataNames turns out to be null

4 Answers 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 18 Mar 2008, 06:20 PM
I'm using a custom IEnumerator to enumerate some custom Objects in my RadGrid.  Sometimes, some of the properties I need to render turn out to be null.  All of that works as I expect during the rendering, leaving the grid cell blank.  The problem comes when I start to add the property name to the ClientDataKeyNames so that I can access the data from JavaScript.

Instead of emitting a null to JavaScript like I'd expect, RadGrid is throwing a NullReferenceException in RadGrid.DescribeProperties(ScriptComponentDescriptor descriptor) +2745 whenever I include one of the property names for which some of my objects have null data.

Am I doing something wrong? Is this a bug? Is there a workaround?

4 Answers, 1 is accepted

Sort by
0
Steve
Top achievements
Rank 1
answered on 19 Mar 2008, 06:19 AM
I've also tried incorporating the RetrieveNullAsDBNull="true" into my GridTableView, but that didn't make any difference.
0
Vlad
Telerik team
answered on 19 Mar 2008, 07:21 AM
Hi Steve,

I'm afraid that you cannot set null in ClientDataKeyNames. If you post a bit more info about desired result I will gladly help you to achieve your goal.

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Steve
Top achievements
Rank 1
answered on 19 Mar 2008, 01:43 PM
I am not trying to add null to ClientDataKeyNames.   What I am trying to do is add a property name to ClientDataKeyNames for which some of my objects happen to have null values.

For example, I have a DateTime? DateOfBirth property and a string Gender property whose values I want exposed at the client.  For certain objects in my ITypedList/IEnumerable collection, the DateOfBirth or Gender is not known, and the property value in that object is a null.  When that happens, I get the exception I described above.  What I expect to happen is for the property value to be rendered out to JavaScript as a JavaScript null for those properties of those particular objects.
0
Rosen
Telerik team
answered on 24 Mar 2008, 01:51 PM
Hi Steve,

Unfortunately this issue is present in current version of RadGrid Prometheus. But I'm happy to inform you that our developers have already addressed the problem and therefore it will be available in next "features release" which will be released this week. I have updated your Telerik points for pointing this one out.

Greetings,
Rosen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Answers by
Steve
Top achievements
Rank 1
Vlad
Telerik team
Rosen
Telerik team
Share this question
or