Suppression State Error (active) CS1503 Argument 2: cannot convert from 'method group' to 'EventCallback' on Datagrid

Hi,

when i choose a row of a datagrid blazor should open an modal dialog with the data of the row.

But at the moment the grid gives me the error describes in subject: Here my code:

Whats wrong?
Best Regards



<SfGrid @ref="@partsGrid" AllowPaging="true" AllowReordering="true" AllowSelection="true" DataSource="@listParts">
    <GridEvents RowSelected="showPartDlg" TValue="TblPart"></GridEvents>
    <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true"></GridEditSettings>
    <GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Single" Mode="Syncfusion.Blazor.Grids.SelectionMode.Row"></GridSelectionSettings>
    <GridColumns>
        <GridColumn Field="@nameof(TblPart.PartId)" IsPrimaryKey="true" HeaderText="Part ID" Width="18"></GridColumn>
        <GridColumn Field="@nameof(TblPart.MainCatId)" HeaderText="Main ID" Width="20"></GridColumn>
        <GridColumn Field="@nameof(TblPart.SubCatId)" HeaderText="Sub ID" Width="18"></GridColumn>
        <GridColumn Field="@nameof(TblPart.DetailId)" HeaderText="Det ID" Width="18"></GridColumn>
        <GridColumn Field="@nameof(TblPart.Partname)" HeaderText="Partname" Width="150"></GridColumn>
        <GridColumn Field="@nameof(TblPart.Partdescription)" HeaderText="Partdescription" Width="150"></GridColumn>
    </GridColumns>
</SfGrid>

@code {
SfGrid partsGrid { get; set; }
List? listParts { get; set; }
List? mainCategories;
List? subCategories;
List? detailCategories;


private bool IsVisiblePartDialog { get; set; } = false;
public List SelectedRowIndexes { get; set; }
public double[] TotalValue { get; set; }
public string SelectedValue;
...

public async Task showPartDlg(Syncfusion.Blazor.Grids.RowSelectEventArgs args)
{
SelectedRowIndexes = await this.partsGrid.GetSelectedRowIndexes();
TotalValue = SelectedRowIndexes.ToArray();
SelectedValue = "";
foreach (var data in TotalValue)
{
SelectedValue = SelectedValue + " " + data;
}
StateHasChanged();
this.IsVisiblePartDialog = true;
}

3 Replies 1 reply marked as answer

MP Marko Petsch April 17, 2022 03:43 PM UTC

Oh i forgot to tell you the error occurs in _host.cshtml


<component type="typeof(App)" render-mode="ServerPrerendered" />




MP Marko Petsch April 18, 2022 08:20 AM UTC

Ok, issue solved. It was a reference to a wrong class. To get the the choosen row data i have to use args parameter, after that it was no problem to implement the functionality. Oh and i don't use RowSelected anymore, instead i use OnRecordDoubleClick, its the better chose, though i can select with a single click the row and with doubleclick i can show the dialog with the part details.

So long

Best Regards 



RN Rahul Narayanasamy Syncfusion Team April 18, 2022 02:06 PM UTC

Hi Marko,


Greetings from Syncfusion.


We are happy to hear that you have resolved the reported problem. Yes, the reported problem will occur while providing different TValue values to Grid events. You need to provide the same correct class value in events to resolve the problem.


Please get back to us if you need further assistance.


Regards,

Rahul


Marked as answer
Loader.
Up arrow icon