- Home
- Forum
- ASP.NET MVC - EJ 2
- HTML encoding in Grid column
HTML encoding in Grid column
Hello,
once again I have encountered a problem I cannot solve by myself.
I'm trying to hide html tags from my column (see the snippet below), however the .DisableHtmlEncode(false /true) apparently does not do anything, no matter what I try.
The header remains unchanged (always shows the tag) and the values for the column as well.
Could you perhaps point me to the right direction?
I saw this example:
https://ej2.syncfusion.com/aspnetmvc/documentation/grid/cell/
but I see no significant difference.
Currently running Syncfusion EJ2, v. 18.1500.0.42
@Html.EJS().Grid("DataGridDecisions").DataSource(dataManager =>
{
dataManager.Json(ViewBag.decisions).Adaptor("RemoteSaveAdaptor");
}).AllowResizing(true).AllowSorting().AllowFiltering().Columns(col =>
{
col.Field("RecommendationStatus").AllowEditing(false).HeaderText("Recomendation").Add();
col.Field("Comment").AllowEditing(false).HeaderText("<div>Comment</div>").DisableHtmlEncode(false).Add();
col.Field("ApprovingUser.ProjectResponsibility.NameForReports").AllowEditing(false).HeaderText("Approver").Add();
}).AllowPaging(false).EditSettings(edit => { edit.AllowEditing(false); }).FilterSettings(filter => { filter.Type(Syncfusion.EJ2.Grids.FilterType.Excel); }).AllowSelection().SelectionSettings(select => select.Type(Syncfusion.EJ2.Grids.SelectionType.Single)).Render()
Thank you for your help!
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
SK
Sujith Kumar Rajkumar
Syncfusion Team
July 23, 2020 10:16 AM UTC
Hi Petr,
Greetings from Syncfusion support.
We checked your reported problem but unfortunately were unable to reproduce it from our end as the html tags were properly decoded on setting the DisableHtmlEncode as false. Please check below sample for your reference,
We suggest you to upgrade your Syncfusion packages to the latest version(v18.2.46) and check if problem is resolved.
If problem still persists can you share us the following additional information to validate further on this,
- Are any console errors thrown?
- Entire Grid code file
- If possible provide us a simple sample to replicate the problem or try reproducing it in the above provided sample. It would be helpful to narrow down the problem scenario and provide a proper solution based on that.
Let us know if you have any concerns.
Regards,
Sujith R
Marked as answer
PE
Petr
July 26, 2020 08:59 PM UTC
Dear Sujith,
updating Syncfusion packages has indeed helped me to get this working.
No changes in the code are needed and it works like a charm.
Thank you for your help!
Petr
SK
Sujith Kumar Rajkumar
Syncfusion Team
July 27, 2020 06:40 AM UTC
Hi Petr,
You’re welcome. We are glad to hear that your problem has been resolved. Please get back to us if you require any further assistance.
Regards,
Sujith R
AK
Aman kumar
May 22, 2023 09:01 AM UTC
Hi how we display encoded content in grid column in mvc .pls help as soon as
HK
Harini Kannan
Syncfusion Team
May 29, 2023 04:06 AM UTC
Hi Aman,
Query: HTML encoding in Grid column
As per your query you can display a encoded content in grid column in mvc by using this property "disableHtmlEncode: true" if you enable this property It will automatically generate the column by encoding the header content and column content. We have provided the documentation and API for your reference.
Documentation: https://helpej2.syncfusion.com/aspnetmvc/documentation/grid/cell/content
Regards,
Harini
SIGN IN To post a reply.