0
I am trying to put a condition in a Webgrid line and the following error occurs: Cannot convert lambda expression to type 'string' because it is not delegate type
Even based on this post Variable content is not displayed in the View with credits from Meajudasilvio I can’t make it work:
grid.Column(Model.DescricaoServico_002, format: (item) =>
{
if (item.Status == 1)
{
return Html.Raw(@<text><div><a href="@Url.Action("ExportarPDFSelecionado", "ProcessamentoRegistros", new { idprocessamentodiario = item.IdProcessamentoDiario, idservico = item.Servico_002.Length > 0 ? item.Servico_002.Substring(item.Servico_002.Length - 3, 3) : item.Servico_002 })" target='_blank'>@(item.Servico_002.Length > 0 ? item.Servico_002.Substring(0, item.Servico_002.Length - 3) : item.Servico_002)</a></div></text>);
}
else
{
return Html.Raw("<font color='red'><b>Inativo</b></font>");
}
}),
You’ve already solved it, Adriano?
– Aline
Not yet @Aline
– hard123
Tried to put all your if inline assigned to a variable and replace @ with a "?
– Aline
Ah, and also, if your: item.Servico_002 is an msm string? what is its value?
– Aline
Hi @Aline thanks so much for the suggestions I put yes the
@
and the item is astring
yes, but I managed to solve using thestring.format
. I’ll post the solution.– hard123