I am trying to assign a JS variable to a ViewBag property and use that property in an Html ActionLink.
However, I\'m getting a design time compile error: \"Syntax error\
This won't work. ViewBag works on server side and it will be out of scope when you get the response of an AJAX request. You should use JavaScript to update the values in your view once you get the response.
You also get the error because an assignment should be in a code block:
@{ ViewBag.CustomerID = data.CustomerID; }
However this still won't work because data is a JavaScript variable.