Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Razor: Question about this dynamic object, ViewBag

I use this format but do not realy understand it as well as I'd like to.

@model MyModel
@{
  ViewBag.Title = "My Window";
}

Clearly, the model used for this view is called MyModel.

Please describe the ViewBag and what else it can be used for besides setting the title.  There are other ways to set the title of a Razor file, so what are the benefits of this method?

I though that using a dynamic object and a dynamic property were not advisable unless needed explicitly. Please explain...

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of nmarun
nmarun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

Thanks!