Columns multiline

Hello, how do I make the data appear in multiline format? It is recorded in the database like this: data1<br/> data2<br/> data3<br/>. But when viewing it on the grid, it appears on the same line. In the controller I converted <br/> to /r/n, but it didn't work either. Could you tell me what I should do?

<ejs-grid id="GridRelatorioGerencial">

    <e-data-manager url="@Url.Action("GridGerencial_Read","Relatorios")"

                    adaptor="UrlAdaptor"></e-data-manager>

            <e-grid-columns>

        <e-grid-column field="Codigo" headerText="Proposta" type="string" width="200"></e-grid-column>

        <e-grid-column field="Codigoos" headerText="OS" type="string" width="150"></e-grid-column>

        <e-grid-column field="Data_criacao" headerText="Data" format="dd/MM/yyyy" type="date" width="120"></e-grid-column>

        <e-grid-column field="Nome" headerText="Cliente" type="string" width="150"></e-grid-column>

        <e-grid-column field="Nome_fantasia" headerText="Unidade" type="string" width="200"></e-grid-column>

        <e-grid-column field="Sigla" headerText="Sigla" type="string" width="100"></e-grid-column>

        <e-grid-column field="Local" headerText="Endereço" type="string" width="300"></e-grid-column>

        <e-grid-column field="Listaservicos" headerText="Serviços" type="string" width="120"></e-grid-column>

            </e-grid-columns>

        </ejs-grid>

C#

  string Status_servicos = "";

                if (!string.IsNullOrEmpty(c.Status_servicos))

                {

                    Status_servicos = c.Status_servicos.Replace("<br>", "\r\n");

                }

It appears this way on the grid. But I would like it to appear in line breaks after each number

1.Vist

2.Vist

3.RO

4.At.Proj

Image_9239_1695664723851


Thanks.



2 Replies 1 reply marked as answer

RR Rajapandi Ravi Syncfusion Team September 26, 2023 12:59 PM UTC

Hi Fernando,


Greetings from Syncfusion support


After reviewing your query, we could see that you are maintaining htmlStrings in the datasource and like to display the records in the Grid based on that htmlStrings. In EJ2 Grid, the htmlString are shown as like in the dataSource. By setting the disbleHtmlEncode property of column as false, you can decode the htmlString into html Elements for that column. Please refer the below documentation, code example and sample for more information.


Displaying Html content Doc: https://ej2.syncfusion.com/aspnetcore/documentation/grid/cell/content


DisableHtmlEncode: https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Grids.GridColumn.html#Syncfusion_EJ2_Grids_GridColumn_DisableHtmlEncode


 

<ejs-grid id="Grid" dataSource="ViewBag.dataSource" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })" allowPaging="true">

        <e-grid-pagesettings pageCount="5"></e-grid-pagesettings>

        <e-grid-columns>

            <e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" textAlign="Right" width="100"></e-grid-column>

            <e-grid-column field="CustomerID" headerText="Customer Name" width="140"></e-grid-column>

            <e-grid-column field="EmployeeID" headerText="Employee ID" width="140"></e-grid-column>

            <e-grid-column field="OrderDate" headerText="Order Date" editType="datepickeredit" format="yMd" width="120"></e-grid-column>

            <e-grid-column field="ShipCity" disableHtmlEncode="false" headerText="Ship City" width="140"></e-grid-column>

        </e-grid-columns>

    </ejs-grid>

 


Sample:


Screenshot:



Regards,
Rajapandi R


Attachment: 184707_ea73535a.zip


FE Fernando October 2, 2023 12:02 PM UTC

Hello,

It worked properly

Thanks


Marked as answer
Loader.
Up arrow icon