gustavnavar / Grid.Blazor

Grid component with CRUD for Blazor (client-side and server-side) and ASP.NET Core MVC
GNU Lesser General Public License v2.1
698 stars 135 forks source link

Condition and Id on RenderValueAs #410

Closed wowraam closed 6 months ago

wowraam commented 6 months ago

How to add an if condition to the RenderValueAs column?

I would like to check the status of different columns and add a button. example: Need to add a button after Update Profile as Review Profile when the ProfileStatus == 'Submitted' @await Html.Grid(Model).Columns(columns => { columns.Add(x => x.FirstName); columns.Add(x => x.LastName); columns.Add(x => x.Email); columns.Add(x => x.PhoneNumber); columns.Add(x => x.isActive); columns.Add(x => x.ProfileStatus); columns.Add(o => o.Id).Encoded(false).Sanitized(false).Titled("Action") .RenderValueAs(o => $" Edit " + $" Update Profile + $" "); }).RenderAsync()

wowraam commented 6 months ago

nevermind found the fix with columns.add()