1
Instead of displaying the value of item.Endereco
in Webgrid what is displayed is a text @item.Endereco.Length > 0 ? item.Endereco.Substring(0, item.Endereco.Length - 3) item: item..
In my current scenario I have to do this validation with the substring
in View (on webgrid)
@grid.GetHtml(
tableStyle: "grid",
headerStyle: "head",
columns: grid.Columns(
grid.Column("Empresa", "Empresa"),
grid.Column("Nome", format: @<text><a href="@Url.Action("Index", "Home", new { id = item.Id})">@item.Nome</a></text>),
grid.Column("Endereco", format: @<text><a href="@Url.Action("Index", "Contato", new { id = item.Id})">@item.Endereco.Length > 0 ? item.Endereco.Substring(0, item.Endereco.Length - 3) : item.Endereco</a></text>)
)
)
Thanks @Meaudasilvio worked correctly, but I have another situation like this: formatting within an if condition in Html.Row here (https://answall.com/questions/212730/erro-ao-crea-umacondi%C3%A7%C3%A3o-no-html-raw-do-webgrid) I thank you.
– hard123