Question About masterPages

Gibou

Active member
Joined
Mar 4, 2009
Messages
25
Location
Paris
Programming Experience
5-10
Hello,

I'm a beginner in ASP and VB and I would like to understand a thing.
I'm used to develop respecting the MVC design-pattern and I'm wondering what should I put in the masterPage controller ? (myMasterPage.master.vb).

I've already put all controllers in the associated aspx webform and I don't understand the usage of another controller. Moreover, if I don't make a mistake, all in the masterPage is static and the final user has no interactivity with it, right ? So, to me, there is nothing to control.

Thank you
 
Masterpages is merged with the requested content page, which together makes the user interface, ie the View in MVC. Both the master and the content may have dynamic elements linking to Controller>Model.
 
I understand but could you give me an example of short code that must be present in the MyMasterPage.master.vb and not in the MyContentPage.aspx.vb ? The masterPage and the content page are merged, that i know, so, one of those two controllers is useless, no ?
 
You should read general articles about MVC to better understand the concept, understanding the theory is the key to better implement it in concrete cases. MS also has a MVC framework for ASP.Net out in RC version right now, check out the tutorials and learning videos there, especially the "Understanding Models, Views, and Controllers".
A view should contain only logic related to generating the user interface. A controller should only contain the bare minimum of logic required to return the right view or redirect the user to another action (flow control). Everything else should be contained in the model.
 
Assuming that you're using the ASP.NET MVC Framework, which has reached RTM, there is no master controller. Each controller generates a view and if that view has a master page then the master content will be merged with the child view. If the master page needs data from the individual controllers then you pass that data via the ViewState.
 

Latest posts

Back
Top