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 {
SfGridpartsGrid { get; set; }
List? listParts { get; set; }
List? mainCategories;
List? subCategories;
List? detailCategories;
private bool IsVisiblePartDialog { get; set; } = false;
public ListSelectedRowIndexes { get; set; }
public double[] TotalValue { get; set; }
public string SelectedValue;
...
public async Task showPartDlg(Syncfusion.Blazor.Grids.RowSelectEventArgsargs)
{
SelectedRowIndexes = await this.partsGrid.GetSelectedRowIndexes();
TotalValue = SelectedRowIndexes.ToArray();
SelectedValue = "";
foreach (var data in TotalValue)
{
SelectedValue = SelectedValue + " " + data;
}
StateHasChanged();
this.IsVisiblePartDialog = true;
}
Oh i forgot to tell you the error occurs in _host.cshtml
<component type="typeof(App)" render-mode="ServerPrerendered" />
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
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