c# - Viewbag properties inside action link helper -


i trying include , viewbag object inside actionlink helper.

@html.actionlink( "date" + viewbag.icon , "index", new{ sortby=viewbag.datesort}) 

logic viewbag.

viewbag.icon = (viewbag.datesort ==  "date desc") ? "▼" :"▲"; 

i implement sort here.

just add datesort viewbag in controller, , in view:

@{   var dateheader = "date " + (viewbag.datesort ==  "date desc" ? "▼" : "▲"); }  @html.actionlink(dateheader, "index", new { sortby = viewbag.datesort }) 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -