We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Bind column to model method

I have a model with  a method.

For simplicity, let's say it's List<Person>.

Person has

Last + ", " + First + " " + Mid

When I try to bind the column:

<GridColumn Field=@nameof(People.Full()) HeaderText="Grower" TextAlign="TextAlign.Left" Width="250"></GridColumn>

it gives an error. 

Then I tried this in the model:

public string FullComputed => Full();


<GridColumn Field=@nameof(People.FullComputer) HeaderText="Grower" TextAlign="TextAlign.Left" 

That just shows as blank.

How can I accomplish this?

1 Reply

SP Sarveswaran Palani Syncfusion Team March 14, 2023 03:41 AM UTC

Hi Keith,

Greetings from Syncfusion support.

We would like to inform you that, we didn’t have direct support to bind values based on your requirement. However, we suggest using our column template feature to customize your column according to your needs. With column templates, you can define your own custom HTML and use it to render the values in the column. This will give you the flexibility to customize the column as per your requirement. We have attached a sample and documentation link for your reference. Let us know if you need any further assistance with this.

<GridColumn HeaderText="Full Name" TextAlign="TextAlign.Center" Width="120">



                    var employee = (context as EmployeeData);

                    <div> @employee.FirstName  @employee.LastName





Reference: https://blazor.syncfusion.com/documentation/datagrid/column-template


Attachment: SfGridBindValue_f80d4ce9.zip

Live Chat Icon For mobile
Up arrow icon