Bind column data grid value to Button

Hi everyone,
I'm working with Radzen Data Grid y Radzen Button for this form.
The form brings "documents data (only header information), and originally had RowSelect property. Resulting people click a Row and going into another edit form. The problem begins when there's another 2 actions: legal modification and nullification. I already worked in adding this 2 "new columns" and the button. But I need the first "document edit" function.

I already figured out to another a button in the "Id document" datagridcolumn of ID, and take the user to the simple editing form, but the problem is that adding this button in the column, I cannot pass the "id value" to text, and also, I cannot give it the auto-fill size.

Code is:

        <RadzenDataGrid @ref="grid0" FilterMode="Radzen.FilterMode.Advanced" AllowPaging="true" AllowSorting="true" 
Data="@getDocumentosResult" TItem="DocumentosDTO" >
    <Columns>
        <RadzenDataGridColumn TItem="DocumentosDTO" Property="Id" Title="Id" SortOrder="SortOrder.Descending" Width="75px">
        <Template Context="selectedData" >
            <RadzenButton ButtonStyle="ButtonStyle.Info" Size="ButtonSize.Medium" Text="" Click="@(() => ShowDocument(selectedData.Id))" />
            </Template> 
        </RadzenDataGridColumn>
        <RadzenDataGridColumn TItem="DocumentosDTO" Property="ModifyDocument" Title="MODIFICAR" Sortable="false">
            <Template Context="selectedData">
            <RadzenButton ButtonStyle="ButtonStyle.Primary" Icon="edit" Click="@(() => ShowInlineDialog(selectedData.Id))" />
            </Template>
        </RadzenDataGridColumn> 
        <RadzenDataGridColumn TItem="DocumentosDTO" Property="NullifyDocument" Title="ANULAR" Sortable="false">
            <Template Context="selectedData">
            <RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="delete" Click="@(() => ShowInlineDialog2(selectedData.Id))" />
            </Template>
        </RadzenDataGridColumn>
    </Columns>
</RadzenDataGrid>

Hi @jonhurono,

The code you have provide looks correct and should work. What is the actual problem that you are facing? A similar implementation is available here: Blazor DataGrid custom appearance via column templates

The code is very similar to yours:

<RadzenDataGridColumn Width="160px" TItem="Order" Property="OrderID" Title="Order Details">
  <Template Context="data">
    <RadzenButton ButtonStyle="ButtonStyle.Info" Icon="info" Class="m-1" Click=@(() => OpenOrder(data.OrderID)) Text="@data.OrderID.ToString()" />
  </Template>
</RadzenDataGridColumn>
1 Like

I didn't know how to give the data value in the button. The code Text="@data.OrderID.ToString()" was right. In my case, I wrote Text="@selectedData.Id.ToString()" .

Thanks for your support! you can close the Thread/Question :grin: