Converting value of bound property

Consider this basic (experimental) code:

    <SfGrid DataSource="@configs" Width="1200">

        <GridColumns>

            <GridColumn Field=@nameof(Definition.Description) HeaderText="Description" TextAlign="TextAlign.Left" MaxWidth="600"></GridColumn>

            <GridColumn Field=@nameof(Definition.Name) HeaderText="Name" TextAlign="TextAlign.Left" MaxWidth="150"></GridColumn>

            <GridColumn Field=@nameof(Definition.Scope) HeaderText="Scope" TextAlign="TextAlign.Left" Width="40"></GridColumn>

            <GridColumn Field=@nameof(Definition.ConfigId) HeaderText="Config ID" TextAlign="TextAlign.Left" Width="120"></GridColumn>

        </GridColumns>

    </SfGrid>


I want the displayed column value for Definition.ConfigId to be forced uppercase, is there a straightforward way? The value is a string property (a GUID string) and it uses lowercase letters, we need this to be uppercase when displayed.








1 Reply

SP Sarveswaran Palani Syncfusion Team September 1, 2022 04:39 PM UTC

Hi Hugh,


Greetings from Syncfusion support.


Query: “Converting value of bound property from lower case to upper case”


We have analyzed your query and suspect that you want to change property name from lower case to upper case when displaying. We suggest you to use Template column to customize the cell content in the grid. Kindly refer the attached code snippet for your reference.


<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150">

            <Template>

                @{

                    var a = (context as Order).CustomerID;

                    @a.ToString().ToUpper();

                }

            </Template>


Please get back to us if you have any further queries.


Regards,

Sarveswaran PK


Loader.
Up arrow icon