Web grid MVC 3- If syntax for checking a condition

Har*_*ala 2 asp.net-mvc-3

I have a syntax error here, Could any one point out what is this please?

I have ViewBag.IsAdmin from the Controller

//code- I am writing this in a view-webgrid
grid.Column(format : (item) => {
                                 if(ViewBag.isAdmin)
                                  {

                                          Html.ActionLink("Edit", "EditSingleAbsence","Absence", new { AbsenceId = item.id }, null);
                                  }
                               }
          )    
/code ended
Run Code Online (Sandbox Code Playgroud)

It compalines with this error:

  CS1502: The best overloaded method match for 'System.Web.Helpers.WebGrid.Column(string, string, System.Func<dynamic,object>, string, bool)' has some invalid arguments
Run Code Online (Sandbox Code Playgroud)

I have found answer from here

Here Solution

No Need to use if condition..

grid.Column(format:(item) => ViewBag.isAdmin ? Html.ActionLink("Edit", "EditSingleAbsence", "Absence", new { AbsenceId = item.id }, null) : Html.Raw("")) 
Run Code Online (Sandbox Code Playgroud)

Har*_*ala 8

工作方案

谷歌搜索后,这对我有用.我从这里得到了这个解决方案

grid.Column(format:(item) => ViewBag.isAdmin ? Html.ActionLink("Edit", "EditSingleAbsence", "Absence", new { AbsenceId = item.id }, null) : Html.Raw("")) 
Run Code Online (Sandbox Code Playgroud)