We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Error when select row after grouping column in DataGrid

Hello

The row selection works fine normally, but after grouping by column, I get the following error :

Error: System.InvalidOperationException: Nullable object must have a value. at System.Nullable`1.get_Value() at Syncfusion.Blazor.Grids.Internal.Selection`1.SelectByRow(Row`1 rowToSelect, MouseAndKeyArgs evt) at Syncfusion.Blazor.Grids.Internal.Selection`1.RowSelectionClickHandler(MouseAndKeyArgs e, ValueTuple`3 target) at Syncfusion.Blazor.Grids.Internal.Selection`1.ClickHandler(MouseEventArgs e, ValueTuple`3 target) at Syncfusion.Blazor.Grids.Internal.GridCellBase`1.CellClickHandler(MouseEventArgs e, Boolean IsCheckBox) at Syncfusion.Blazor.Grids.Internal.GridCell`1.b__0_12(MouseEventArgs e) at System.Threading.Tasks.Task.<>c.b__128_0(Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource completion, SendOrPostCallback d, Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteBackground(WorkItem item)

This problem does not occur when all rows are selected and only occurs when one row is selected

My Code is :

<SfGrid @ref="@Grid" DataSource="@forecasts" Height="400" AllowSelection="true" AllowGrouping="true" AllowSorting="true" AllowPaging="true" EnableRtl="true" AllowFiltering="true">

                <GridSelectionSettings AllowDragSelection="true" Type="SelectionType.Multiple" Mode="SelectionMode.Row"></GridSelectionSettings>

                <GridEvents Created="Created" RowSelected="GetSelectedRecords" TValue="WeatherForecast"></GridEvents>

                <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"></GridFilterSettings>

                <GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>

                <GridGroupSettings ></GridGroupSettings>

                    <GridColumns>

                        <GridColumn Type="ColumnType.CheckBox" Width="50"></GridColumn>

                        <GridColumn Field=@nameof(WeatherForecast.Date) HeaderText="تاریخ" TextAlign="TextAlign.Right" Width="120"></GridColumn>

                        <GridColumn Field=@nameof(WeatherForecast.TemperatureC) HeaderText="دما (سانتیگراد )" Width="150"></GridColumn>

                        <GridColumn Field=@nameof(WeatherForecast.TemperatureF) HeaderText=" دما ( فارنهایت )" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>

                        <GridColumn Field=@nameof(WeatherForecast.Summary) HeaderText="توضیحات" TextAlign="TextAlign.Right" Width="120"></GridColumn>

                    </GridColumns>

                </SfGrid>

@code {

    public string[] GroupedColumns = new string[] { "Date" };

    private IEnumerable<WeatherForecast> forecasts;

    SfGrid<WeatherForecast> Grid;

    public List<double> SelectedRowIndexes { get; set; }

    public double[] TotalValue { get; set; }

    public string SelectedValue;

    public List<WeatherForecast> SelectedRecord { get; set; }

    protected override async Task OnInitializedAsync()

    {

        forecasts = await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now));


    }

    public async Task GetSelectedRecords(RowSelectEventArgs<WeatherForecast> args)

    {

        SelectedRowIndexes = await this.Grid.GetSelectedRowIndexes();

        SelectedRecord = await this.Grid.GetSelectedRecordsAsync();

        TotalValue = SelectedRowIndexes.ToArray();

        SelectedValue = "";

        foreach (var data in TotalValue)

        {

            SelectedValue = SelectedValue + " " + data;

        }

        StateHasChanged();

    }

    public async Task Created()

    {

        await IJsRuntime.InvokeAsync<object>("SelectAll");

    }

  

}


Thank you for your help in this case


5 Replies 1 reply marked as answer

AL Ali.S January 31, 2023 06:58 AM UTC

Hello again

Does anyone know about this? Is this a bug?

please check it



MS Monisha Saravanan Syncfusion Team January 31, 2023 12:03 PM UTC


Hi Meysam,

Sorry for the inconvenience that you have experienced with our product. We understand the importance of a stable and reliable product for your business, and we take your concerns very seriously.


We have already considered it as a bug and fixed the issue  “Exception occurs when selecting a record.” for the same. Thank you for taking the time to report this issue and helping us to improve our product. At Syncfusion, we are committed to fix all validated defects (subject to technological feasibility and Product Development Life Cycle) and the fix will be included in the upcoming weekly patch release by the first week of February or in the Volume 4 SP.


We will inform you once the fix has been published. We appreciate your patience until then. You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.       


https://www.syncfusion.com/feedback/40556/exception-occur-when-selecting-a-record-with-details-template


Regards,
Monisha




AL Ali.S replied to Monisha Saravanan January 31, 2023 01:29 PM UTC

Hello

Thank you for your attention and response The registered error link warns me about the Access Denied . But I will wait for a new update anyway to fix this problem

Thanks



MS Monisha Saravanan Syncfusion Team February 1, 2023 09:51 AM UTC


Hi Meysam,


We apologize for any inconvenience you may have experienced. We are pleased to inform you that access to your mail has been restored. Thank you for bringing this issue to our attention, and we will keep you updated on the release of any updates. Until then we value your patience.


Regards,

Monisha



MS Monisha Saravanan Syncfusion Team February 3, 2023 04:36 AM UTC


Hi Meysam,

We are glad to announce that our Essential Studio 2022 patch Release v20.4.0.48 is rolled out and is available for download under the following link and we have included fix for the issue   “Exception occurs when selecting a record with details template.” in our patch release (20.4.0.48).


NuGet : https://www.nuget.org/packages/Syncfusion.Blazor.Grid


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Regards,
Monisha


Marked as answer
Loader.
Live Chat Icon For mobile
Up arrow icon