Hello all,
Is it possible to add a hyperlink inside a datagrid column element, and associate it with a function call, similar functionality to @onclick... . ?
If possible to add a hyperlink, how to accomplish it?
Thanks in advance!
Hello all,
Is it possible to add a hyperlink inside a datagrid column element, and associate it with a function call, similar functionality to @onclick... . ?
If possible to add a hyperlink, how to accomplish it?
Thanks in advance!
Yes, it is possible - just add the hyperlink and assign its @onclick
attribute. You can pass the Template context as an argument:
<RadzenDataGrid TItem="Order" Data=@orders>
<Columns>
<RadzenDataGridColumn TItem="Order">
<Template Context="order">
<a @onclick="@(() => OnLinkClick(order))">Click</a>
</Template>
</RadzenDataGridColumn>]
</Columns>
</RadzenDataGrid>
@code {
void OnLinkClick(Order order)
{
}
}
Great.
Thanks a lot for your reply!
Hello. I followed your code.
The @onclick works but when I hover over 'Click' it won't display the hyperlink.
Could you please advice?
Thanks
You will need to add an href attribute, it should show the link on hover.
<a @onclick="@(() => OnLinkClick(order))" href=" ">Click
Hi,
is it possibile to show the name of the property binded to the radzen grid?
<RadzenDataGridColumn TItem="MyPersonalData" Property="Identifier" Title="Identificativo" Width="150px">
<Template Context="MyPersonalData">
<a @onclick="@(() => OnLinkClick(personalData))">Identifier</a>
</Template>
</RadzenDataGridColumn>
?
What it's supposed to show is the Identifier and this one should be click-able
Try this:
<Template Context="personalData">
<a @onclick="@(() => OnLinkClick(personalData))">@personalData.Identifier</a>
</Template>
Thank you very much! Problem was in the Template Context