straight forward question , can\'t seem to get my viewBag value to display in a view that the user is directed to after completing a form.
Please advise..thanks
You can try this way also
Controller
public ActionResult Test() { ViewBag.controllerValue= "testvalue"; .................. }
View - define top of razor page @{string testvalue= (string)ViewBag.controllerValue;}
@{string testvalue= (string)ViewBag.controllerValue;}
$(function () { var val= '@testvalue'; });