Hi Aleqsandre,
Thanks for contacting Syncfusion support.
Query: “if possible I want hide in each of grids row template record, hidden id and read it on button click”
We have analyzed your query and we understand that you want to display some text in row template of Grid on button click. We have achieved your requirement by rendering the component inside the RowTemplate as separate component and displayed the text using Boolean value.
Refer the below code example.
|
<SfGrid DataSource="@Employees" Height="335px">
<GridTemplates>
<RowTemplate Context="emp">
@{
var employee = (emp as EmployeeData);
. .
<BtnComp Record="employee"></BtnComp>
. . . .
}
</RowTemplate>
</GridTemplates>
<GridColumns>
<GridColumn HeaderText="Employee Details" Width="300" TextAlign="TextAlign.Left"></GridColumn>
</GridColumns>
</SfGrid>
[btnComp.razor]
@using Syncfusion.Blazor.Buttons@using Grid.Data <td class="CardHeader">First Name </td><SfButton OnClick="@(()=>Clicked(Record))" Content="Get Data"></SfButton>@if (ToggleData){ <td>@Record.FirstName</td>} @code{ [Parameter] public EmployeeData Record { get; set; } public bool ToggleData { get; set; } public void Clicked(EmployeeData value) { if (ToggleData) ToggleData = false; else ToggleData = true; }} |
Kindly download the sample from below which we have prepared using above solution.
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan