A toy example,
ViewData["rat"] = "Rodent";
var blaw = ViewBag.rat;
ViewData["dig/dug"] = "Game";
// var blaw2 = Viewbag.dig/dug;
The last line of course does not work. How would I access “dig/dug” through the ViewBag?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just use underscore (or some another allowed symbol) instead of slash. Slash is not allowed:
Since ViewBag is dynamic dig/dug will be a property of dynamic object.
You can’t use some special symbols(/,. etc..) within name of properties: