I'm getting this error when bound data list for a detail template is null
I don't have a Parameter 'source' in any model so don't understand what this is in reference to?
<DetailTemplate>
<div class="form-group form-inline right">
@{
var bookingEquip = context as BookingEquipmentModel;
<TelerikGrid @ref="@bookingEquipmentCommodityGridRef"
Data="bookingEquip.Commodities"
Pageable="true"
PageSize="4"
Resizable="true"
Size="@ThemeConstants.Grid.Size.Small"
Width="90rem"
EditMode="@GridEditMode.Incell"
OnDelete="@((GridCommandEventArgs args) => OnCommodityDelete(args, bookingEquip))"
OnCreate="@((GridCommandEventArgs args) => OnCommodityCreate(args, bookingEquip))"
OnUpdate="@((GridCommandEventArgs args) => OnCommodityUpdate(bookingEquip, args))">
<GridToolBarTemplate>
<!-- can only add a single commodity if there are none associated with this equipment) -->
<GridCommandButton Command="Add" Class="btn-green" Icon="@FontIcon.Plus" Enabled="@(!bookingEquip.Commodities.Any())">Add Commodity</GridCommandButton>
</GridToolBarTemplate>
<GridColumns>
<!-- Commodity Types -->
<GridColumn Field=@nameof(BookingEquipmentCommodityModel.CommodityType) Editable="true" Title="Description" Width="6rem">
<EditorTemplate Context="cbecContext">
@{
_currentBookingEquipmentCommodityModel = cbecContext as BookingEquipmentCommodityModel;
if (_currentBookingEquipmentCommodityModel != null)
{
<TelerikDropDownList Data="@_CommodityList"
Value="@_currentBookingEquipmentCommodityModel.CommodityTypeId"
for the Data reference, bookingEquip is NOT null but it's property bookingEquip.Commodities is indeed null (expected).
The grid displays correctly, but as soon as I click on the "+" expand it will crash with exception in the control.
I'm puzzled as to why this is happening? When I populate other grids (not using a DetailTemplate) in my Blazor app, and the Data reference is a null, nothing is displayed/render in the grid and I just get a "No records available." ... which is good. But the same behavior doesn't seem to happen when using DetailTemplate?
Any suggestions?
Rob.