Can't use Event on childgrid inside Parent Grid

I'm trying to make event for a child grid in this code:

<SfGrid DataSource="@lists" ID="container" @ref="TaskGrid" Toolbar="@(new List<object>() { "Print" })" AllowSelection="true"
AllowSorting="true" AllowFiltering="true" AllowPaging="true" AllowTextWrap="true"
EnableHover="false" RowHeight="38">
     <GridTemplates>
          <DetailTemplate>
@{
var tasku = new tasku ();
<SfGrid DataSource="@taskdetails" AllowSelection="true" AllowSorting="true" AllowPaging="true"                                                                            AllowTextWrap="true" EnableHover="true"
Toolbar="@gridToolBar" RowHeight="38">
<GridEvents  TValue="TasksTasks" OnToolbarClick="ToolbarClickHandler"></GridEvents>
<GridSelectionSettings Mode="Syncfusion.Blazor.Grids.SelectionMode.Row"></GridSelectionSettings>
<GridEditSettings AllowAdding="true"
  AllowEditing="true"
  AllowEditOnDblClick="true"
  AllowDeleting="true"></GridEditSettings>
<GridSortSettings>
</GridSortSettings>
<GridColumns>
<GridColumn Field=@nameof(TasksTaskUpdates.UpdateId) IsPrimaryKey="true" AllowAdding="false"
AllowEditing="false" HeaderText="Update Id" Width="100"></GridColumn>
<GridColumn DefaultValue="@DateTime.Today" Field=@nameof(TasksTaskUpdates.UpdateDate)
HeaderText="Update Date" Width="100"></GridColumn>
<GridColumn Field=@nameof(TasksTaskUpdates.Update) HeaderText="Update" Width="500"
ClipMode="ClipMode.EllipsisWithTooltip"></GridColumn>
</GridColumns>
</SfGrid>
}
</DetailTemplate>
</GridTemplates>

</SfGrid>



But failing because the GridEvents works with parent grid when clicked on print of parent grid, though i added the event in child SfGrid

1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team November 16, 2020 12:38 PM UTC

Hi Mostafa, 

Greetings from Syncfusion support. 

We tried reproduce the reported problem by creating a sample based on the shared codes, but we could not face the reported problem from our side. Clicking the Print toolbar item in parent grid does not trigger the OnToolbarClick event of Grid inside DetailTemplate. We are attaching the sample for your reference, please download the sample from the link below, 
 
Please refer the above attached sample and if you still face difficulties, then the following details would be helpful for us to proceed further, 
  1. Share a simple issue reproducing demo. This would be helpful for us to validate the problem based on your scenario.
  2. Share the exact scenario or proper replication procedure.
  3. If possible reproduce the problem with the attached sample and share with us for further analysis.
  4. Share the video demo showing the replication of the problem you are facing.

The provided information will help us analyze the problem, and provide you a solution as early as possible. 

And also we suggest you to ensure to provide proper TValue for GridEvents based on the Grid’s model class. Please refer the below codes and modify the TValue in your application. 

 
<SfGrid DataSource="@lists" ID="container" @ref="TaskGrid" ...> 
    <GridTemplates> 
        <DetailTemplate> 
            @{ 
                <SfGrid DataSource="@taskdetails" AllowSelection="true" ...> 
                    <GridEvents TValue="TasksTaskUpdates" OnToolbarClick="ToolbarClickHandler"></GridEvents> 
                    ... 
                    <GridColumns> 
                        <GridColumn Field=@nameof(TasksTaskUpdates.UpdateId) IsPrimaryKey="true" AllowAdding="false" 
                                    AllowEditing="false" HeaderText="Update Id" Width="100"></GridColumn> 
                        ... 
                    </GridColumns> 
                </SfGrid> 
            } 
        </DetailTemplate> 
    </GridTemplates> 
</SfGrid> 



Regards, 
Renjith Singh Rajendran 


Marked as answer
Loader.
Up arrow icon