GridColumn nameof with same Property name
Hi, I'm loading data on a grid on a Blazor Web Assembly project, getting data from an API, the JSON looks like this
{
"ClientId": 3,
"Name": "DANIEL PEREZ SANCHEZ",
"Branch": {
"BranchId": 1,
"Name": "WEST"
}
}
My grid has the columns to show the Data:
<SfGrid DataSource="@ClientsL" AllowSorting="true" ID="FianzasClientsGrid" AllowTextWrap="true" Toolbar="@(new List<string>() { "Search" })">
<GridEvents CommandClicked="OnCommandClicked" TValue="Client" OnActionBegin="ActionBeginHandler"></GridEvents>
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true">
</GridEditSettings>
<GridColumns>
<GridColumn Field=@nameof(Client.ClientId) HeaderText="Client Id" TextAlign="TextAlign.Center" Width="15"></GridColumn>
<GridColumn Field=@nameof(Client.Name) HeaderText="Nombre" TextAlign="TextAlign.Left" Width="55"></GridColumn>
<GridColumn Field=@nameof(Client.Branch.BranchId) HeaderText="Branch Id" TextAlign="TextAlign.Center" Width="15"></GridColumn>
<GridColumn Field=@nameof(Client.Branch.Name) HeaderText="Branch" TextAlign="TextAlign.Center" Width="15"></GridColumn>
The problem is on Branch Name Column the grid shows Client Name, I guess this happens because Client and Branch have the same property name thas is Name, how Can I tell the grid to show not the Client Name but the Branch Name
Thank you very much
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
RS
Renjith Singh Rajendran
Syncfusion Team
January 11, 2021 08:50 AM UTC
Hi Luis,
Greetings from Syncfusion support.
We suggest you to refer to the below documentation for binding complex field columns in Grid.
Please refer and use as like the codes below,
|
<GridColumn Field=”Branch.Name” HeaderText="Branch" TextAlign="TextAlign.Center" Width="15"></GridColumn>
|
Please get back to us if you need further assistance.
Regards,
Renjith Singh Rajendran
Marked as answer
LR
Luis Roberto
January 11, 2021 02:55 PM UTC
Thank you so much, Renjith, that worked great.
Take Care
RS
Renjith Singh Rajendran
Syncfusion Team
January 12, 2021 04:02 AM UTC
Hi Luis,
We are glad to hear that your requirement has been achieved.
Please get back to us if you need further assistance.
Regards,
Renjith Singh Rajendran
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
LR Luis Roberto
- Jan 8, 2021 08:49 PM UTC
- Jan 12, 2021 04:02 AM UTC