Hello my programming friends,

 I'm currently doing various things in this, and I've tried to create
a "Partial View" (user control). Now I want to give it a "Controller",
but it doesn't appear possible. Am I correct? Is it not possible? What
I want to do is have it be given a common set of data when it's
loaded. My options, as I see it, are:

 1. Pass the data in via Html.RenderPartial("Foo", Model);

 If I take this option I assume there is some scheme (I vaguely read
about an attribute-based approach) whereby I can have each page that
needs to do this call load the data via a common method. Evenso, this
seems bad to me, as I need to remember to mark each page as such, and
remove any such marking if I no longer use the control (or, indeed, if
the control isn't even loaded).

 2. Load the data in a custom script area inside the view itself

 This seems to be non-mvc style. It's not ideal because it doesn't
follow what I assume is the typical scheme, or, shall we say, "Best
Practice". But I may end up going with it, because it results in the
least amount of duplicated code. It does have clear downsides though.

 Any thoughts? Have I missed something obvious?

-- 
silky

Every morning when I wake up, I experience an exquisite joy — the joy
of being this signature.

Reply via email to