ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Grid with Custom Item, server html column value shown as text
Title:
B
I
{code}
?
I need to show a custom item on the grid, but the html values that I'm setting in the controller are shown as plain text in the grid. controller: private static object MapToGridModel(Dinner o) { var xTabela = "<b>Test Table</b>"; var xTag = @"<p><button type='button' class='btn bg-maroon btn-flat margin'>Peça</button><button type='button' class='btn bg-purple btn-flat margin'> Sei lá</button></p>"; return new { o.Id, ... Tag = xTag, Tabela = xTabela, Test = "My Test" }; } [Print] Image link:https://ibb.co/KmhBsyF
Save Changes
Cancel
Leonel Jaime
asked at 18 Apr 2019
Answers
B
I
{code}
?
To achieve the same result, you can set this html in the view, I recommend that you do this using `Column.ClientFormatFunc` or `ClientFormat` (see [https://demo.aspnetawesome.com/GridDemo/CustomFormat grid custom formatting ]). If you want to return html from the server, you could either set `.Encode(false)` this will turn off html encoding for the whole grid, or you could show html server values using a ClientFormatFunc js function, the result of which is not encoded.
Save Changes
Cancel
Omu
answered at 18 Apr 2019
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK