asp.net mvc 3 - Based on Model Column Value(true/False) in MVC3 Webgrid , How can Add a Link as column in diplaying the rows -
asp.net mvc 3 - Based on Model Column Value(true/False) in MVC3 Webgrid , How can Add a Link as column in diplaying the rows -
i using mvc3 webgrid. have model has column of type bool. based on value of coulumn need render coulmn , hyper link. if bool column value true have render record, else edit.
could kindly give syntax these in razor .
thank you
you can utilize if statement when create column, so:
grid.column("conditional cell sample", format: @<text>@if(true == true) { @html.actionlink("go here", "home") } else { @html.actionlink("or here", "away") }</text>)
simply replace true == true condition, , content of if , else need.
ref: http://lottemae.wordpress.com/2011/11/17/using-conditional-statements-in-an-mvc-3-webgrid-column-using-razor/
asp.net-mvc-3
Comments
Post a Comment