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

[Solved] Telerik ASP.NET MVC Grid on Editing in Popup mode gives jscript error

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
George
Top achievements
Rank 1
George asked on 27 Jan 2012, 05:23 AM

I have a Grid, which I am trying to Edit in Pop Up mode. The pop up opens fine. I have placed two more grids within the pop up window. I load them through javascript ajax calls. These 2 grids on pop up also get populated just fine. Once I click on the submit for the pop up window (which is the default checkmark icon), I get this Jscript error "data.CancelledAMA.AgreementID is null or not an object"

Where CancelledAMA is a custom object in my model (ReplacementCombo) that I bind to the original grid (not the 2 grids within the pop up window). And AgreementId is an int within the CancelledAMA object

I have tried the .DefaultDataItem(new ReplacementCombo()) in the original grid so that the model object gets populated with default values and created a constructor object too in the ReplacementCombo model class. But nothing works.

1 Answer, 1 is accepted

Sort by
0
George
Top achievements
Rank 1
answered on 27 Jan 2012, 06:06 AM

People,

I feel proud saying that after hours of pain, I have found the issue and resolved it!

Lesson learnt, on the Telerik MVC Grid you cannot have the DataKey from a nested object of the grid model. My original grid had the datakey as CancelledAMA.AgreementID and CancelledAMA is a nested object within the Model (ReplacementCombo) bound to the original Grid. You can only have a datakey to a property on the top level of the model object not properties of nested objects.

Thanks.

Tags
Grid
Asked by
George
Top achievements
Rank 1
Answers by
George
Top achievements
Rank 1
Share this question
or