You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

900 B

sidebar_position title
3 Add Edit action

In order to reach the editing page, we will therefore modify the grid in order to add a link to our new page with the identifier of our element.

For this we will create a new DataGridColumn column with a DisplayTemplate.

Open the Pages/List.razor file and add the highlighted changes as follows:

...

    <DataGridColumn TItem="Item" Field="@nameof(Item.CreatedDate)" Caption="Created date" DisplayFormat="{0:d}" DisplayFormatProvider="@System.Globalization.CultureInfo.GetCultureInfo("fr-FR")" />
// highlight-start
    <DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="Action">
        <DisplayTemplate>
            <a href="Edit/@(context.Id)" class="btn btn-primary"><i class="fa fa-edit"></i> Editer</a>
        </DisplayTemplate>
    </DataGridColumn>
// highlight-end
</DataGrid>