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

Render Raw HTML

Trying to figure out how I can get one of my columns in a datagrid to render as raw html. Usually I'd just use
@((MarkupString)myMarkup)
but I can't see an equivalent in GridColumn methods/properties.

Thanks

2 Replies

BN Ben Nl December 7, 2019 09:21 AM

Figured out you are meant to use a template, e.g.

<GridColumn Field=@nameof(JobListing.Description) HeaderText="Description" Width="250">
       <Template>
                    @{
                        var job = (context as JobListing);
                        <span>@((MarkupString)job.Description)</span>
                    }
     </Template>
</GridColumn>


VN Vignesh Natarajan Syncfusion Team December 9, 2019 04:08 AM

Hi Ben,  

Thanks for using Syncfusion products.  

Query: “Figured out you are meant to use a template, e.g.” 
 
We are glad to hear that you have resolved your query on your own. You can also achieve your requirement using DisableHtmlEncode property of GridColumn. Refer our UG documentation for your reference. 


Please get back to us if you have further queries.  

Regards, 
Vignesh Natarajan. 


Loader.
Live Chat Icon For mobile
Up arrow icon