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

Unable to get value of the property 'getDataKeyValue': object is null or undefined

9 Answers 436 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jai
Top achievements
Rank 1
Jai asked on 08 Aug 2011, 01:57 PM
Hi,

I am getting following error.
"Unable to get value of the property 'getDataKeyValue': object is null or undefined". I have one grid with CheckBox Column and outside of Grid i have one Button. and when the CheckBox of any row in Grid is selected true and then if i click on the Button outside the grid. I want DataKeyValue of the Grid row. I have follwoing code in Javascript to do.
var grid = $find('<%=((RadGrid) XYZCtrl1.FindControl("GridXYZList")).MasterTableView.ClientID%>');
var dataItem = grid.get_dataItems()[Index];
var keyValues = dataItem.getDataKeyValue("XYZId");
upto second line i am getting objects but in third line i am getting this error
"Unable to get value of the property 'getDataKeyValue': object is null or undefined"
Can anyone tell me please what i am doing wrong here ?

Thanks,
--Jai

9 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 08 Aug 2011, 02:09 PM
Hello,

<MasterTableView DataKeyNames="ID" ClientDataKeyNames="ID">
or
<ClientSettings EnableClientKeyValues="true">
 
i am not much sure this works or not but try above solution.

sorry because i have not enough time and i have to leave office so...

Thanks,
Jayesh Goyani
0
Jai
Top achievements
Rank 1
answered on 08 Aug 2011, 02:21 PM
HI Jayesh,

Thnaks for reply .
There is no property defined in clientsettings for EnableClientKeyValues. And i have already defined the DataKeyNames and ClientDataKeyNames in MasterTableView.
Any other Suggestions please from Anyone else?

Thanks,
--Jai
0
Achuthan
Top achievements
Rank 1
answered on 15 Mar 2013, 09:28 AM


Hi,

                        After creating the grid control ,when i refresh a page , I am getting the error as unable to get a value of property of "propertychange" object is null or undefined like in the attachment file.

Please guide me to solve this issue 
0
Andrey
Telerik team
answered on 20 Mar 2013, 07:45 AM
Hello,

The issue behind both problems is uninitialized object.

@Jai: This is not even a complete statement - var grid = $find('<%=((RadGrid) It should be something similar to : var grid = $find('<%=RadGrid1.ClientID%>');

@Achuthan: On which object you are trying to access the propertychange property?

Regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Tim
Top achievements
Rank 1
answered on 28 May 2013, 03:05 PM
I've been searching these Forums for weeks trying to resolve this issue.  This post seems related to my issue.  If I have my RadGrid inside a FormView's Insert/Edit template, the Grid NEVER initializes its JavaScript.  My scenario does not happen during any Post Backs, it's just that the Grid does NOT initialize any of its client-side API when it's inside another container.  Is there anyway around this?
0
Tim
Top achievements
Rank 1
answered on 28 May 2013, 03:12 PM
I've also noticed that on the "Add Record" button of the Grid's command buttons, the JavaScript looks like this:

if(!$find('').showInsertItem()) return false;

or more accurately...
onclick="if(!$find(&#39;&#39;).showInsertItem()) return false;"
0
Andrey
Telerik team
answered on 31 May 2013, 05:47 AM
Hello,

About your first question, may I ask why you need to place the RadGrid inside FormView control? RadGrid provides built-in functionality to insert/updated/delete records from the datasource. You could check how this is achieved in this online demo application.

About your second question, this was a bug in our older releases which is now fixed. Please upgrade to the latest version and you should not have any problems.

Regards,
Andrey
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Tim
Top achievements
Rank 1
answered on 02 Jun 2013, 01:30 PM
Yes, I have moved the Grid outside the FormView.  The original thought was that it had to be in there because we were editing one parent-record and the grid represented the child data.  But it makes sense to move it out.

Which version was this fixed (2013.1 SP1?), we are using 2013.1.
0
Andrey
Telerik team
answered on 03 Jun 2013, 12:43 PM
Hi,

The bug was fixed for Q1 2013 SP1 release. Using the latest version always guarantee that you have latest fixes.

Regards,
Andrey
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Jai
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Jai
Top achievements
Rank 1
Achuthan
Top achievements
Rank 1
Andrey
Telerik team
Tim
Top achievements
Rank 1
Share this question
or