EditTemplate doesn't work
We're currently working with Grid component in 17.4.0.40 and try to customize the in-line edit, our current GridColumn is this

<GridColumn Field=@nameof(ProductGridRow.ShortDescription) HeaderText="Description" Width="300" AllowSorting="false" Type="ColumnType.String" EditType="EditType.DefaultEdit">
<EditTemplate>
<EjsTextBox Value="@((context as ProductGridRow).ShortDescription)">
</EjsTextBox>
</EditTemplate>
</GridColumn>
but, every time we try to enter in edit mode, we get this error
We've tried also with a completely new grid but still the same error. How can we achieve that?
SIGN IN To post a reply.
5 Replies
VN
Vignesh Natarajan
Syncfusion Team
December 30, 2019 01:24 PM UTC
Hi Pierpaolo,
Greetings from Syncfusion support.
Query: “but, every time we try to enter in edit mode, we get this error”
The reported issue occur in older version of Syncfusion Nuget package when ModelType property of EjsGrid is not defined. But from our 2019 Volume 4 release we have deprecated this (ModelType) property. Hence we are not able to reproduce the reported issue in our latest version 17.4.0.40.
For your convenience we have prepared a sample which can be downloaded from below
Kindly ensure that you have referred the latest version Nuget and script file properly. After ensuring, if you are still facing the issue, kindly get back to us with following details.
- Share your Syncfusion Nuget package version along with script files version.
- Share your full Grid rendering code example.
- Are you facing this issue only while editing a record or while inserting a record also.
- Share your model class.
- If possible try to reproduce the reported issue in provided sample or share the issue reproducible sample.
Regards,
Vignesh Natarajan.
PI
Pierpaolo
December 30, 2019 04:05 PM UTC
We found the problem, it's related to "complex types" and nullables.

Our DTOs has some non-nullable enums that, with EditTemplate, breaks everything.
In fact, using the same example that you give us and modifying the class into this (notice the Test property)
raise the bug. If you put nullable with "?" notation everything works.
The annoying thing is that if you leave it non-nullable and remove the EditTemplate the cell itself goes to edit mode and saves everything without any problem!
Maybe it will be better to improve serialization data for grid.
PI
Pierpaolo
December 30, 2019 04:08 PM UTC
Please notice that this bug can be raised even if your DTOs has properties like this

VN
Vignesh Natarajan
Syncfusion Team
December 31, 2019 12:23 PM UTC
Hi Pierpaolo,
We have prepared a sample as your suggestion and we are able to reproduce the reported issue at our end while editing a record. Currently we are validating your query, we will update you the further details by 2nd January 2020.
Till then we appreciate your patience.
Regards,
Vignesh Natarajan.
VN
Vignesh Natarajan
Syncfusion Team
January 2, 2020 01:00 PM UTC
Hi Pierpaolo,
Thanks for the patience.
We have validated the reported issue and we are able to reproduce the reported issue at our end while preparing a sample using your code example. We have confirmed it is issue and logged the defect report for the same “Null reference error is thrown while using Editing template in Grid”. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our upcoming patch release which is expected to be rolled out on or before 14th January 2020.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this feedback.
Feedback: : https://www.syncfusion.com/feedback/11059/nullreferenceexception-is-thrown-when-using-edittemplate-in-grid
Till then we appreciate your patience.
Regards,
Vignesh Natarajan.
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
PI Pierpaolo
- Dec 27, 2019 04:00 PM UTC
- Jan 2, 2020 01:00 PM UTC