MVC ViewData MVC ViewData Source http www tech archive net
Document Sample


MVC − ViewData
MVC − ViewData
Source:
http://www.tech−archive.net/Archive/DotNet/microsoft.public.dotnet.framework.aspnet/2008−09/msg00755.html
• From: shapper <mdmoura@xxxxxxxxx>
• Date: Sun, 14 Sep 2008 06:04:58 −0700 (PDT)
Hello,
In my views I usually have some data that I need to pass from the
controller to the view:
Page Title, Page Keywords, GoogleAnalyticsURL, ...
Then on some views I also have other data to pass. For example, on
Post View I have PostViewData which contains a list of posts and some
statistics.
My idea was to pass to every view two objects: PageViewData and if
necessary PostViewData, FileViewData, or any other view data object.
I believe this is impossible ... So what would be the best way to do
this? Maybe create for all my views the following:
* PageViewData
o PageTitle
o PageKeywords
o GoogleAnalyticsURL
Then when necessary I would do the following:
* PageViewData
o PageTitle
o PageKeywords
o GoogleAnalyticsURL
o Extra
On extra I would add PostViewData ... but I am not sure how can I do
this because Extra can be PostViewData or any other object in case of
other views.
Anyway, could someone give me some suggestion on how to project this?
Thanks,
MVC − ViewData 1
MVC − ViewData
Miguel
.
MVC − ViewData 2
Related docs
Get documents about "