Passing properties from Radzen Grids to a button for use with routing

I'm attempting to use the Radzen Datagrid in order to have a list of data from a DB, with a button connected to the specific row that redirects users to a dashboard-type view of the data.

I am just running into issues with passing the ID from the specific row to the method which would change the page, with traditional HTML tables this is fairly easy to do as I can access the data properties directly and simple do @onclick="(()=>EditContact(contact.Id))"

This is my current grid, and I would like to pass the ProjectNumber value as well as a Client.Id value to the router when the button is clicked, I'm just not sure how to access those properties through this

`

<Columns>
    <RadzenGridColumn TItem="FullProjectModel" Property="ProjectNumber" Title="Project Number" />
    <RadzenGridColumn TItem="FullProjectModel" Property="ProjectName" Title="Project Name" />
    <RadzenGridColumn TItem="FullProjectModel" Property="Client.CompanyName" Title="Company" />
    <RadzenGridColumn TItem="Order" Bubble="false" Filterable="false" Sortable="false" TextAlign="TextAlign.Center" Width="100px">
        <Template Context="order">
            <RadzenButton Text="Dashboard" @onclick=""/>
        </Template>
    </RadzenGridColumn>
</Columns>

`

This is the data item. There is no onclick however on RadzenButton, the event is Click.

1 Like

It's pretty obvious what he wants to do. I want to do the same think. If you cannot answer the question constructively why bother replying at all!! Very unhelpful and not a good advert for your product, don't you think?!!

Logan_Parker, I hope this is more helpful than the reply you got from the radzen team guy!

    <RadzenGridColumn TItem="Study" Property="StudyId" Sortable="true" Filterable="true" Title="Copy to Dev environment">
        <Template Context="study">
            <RadzenButton Style="margin-left: 20px; margin-top: 20px; width: 140px" Text="Copy" Click="@((arg) => OnCopyStudyClicked(arg, @study.StudyId))"></RadzenButton>
        </Template>
        <FooterTemplate>
        </FooterTemplate>
    </RadzenGridColumn>
1 Like

and the method in the code behind is:

    protected async void OnCopyStudyClicked(MouseEventArgs args, string s)
    {
        Debug.WriteLine($"Copy study ");
    }
1 Like