ViewModel in a masterpage? [closed] - asp.net-mvc

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am using asp.net mvc 3.0 with razor.
I am wondering if I can make a view model for my master page. I have some dynamic data in my master page so I am going to probably have to make a "base class" for all my controllers but I rather have strongly typed data then View Data/ View Bag.
So can this be done?

You could have all of your view models inherit from a base view model, which would include all of your common fields.
Alternatively, you could use a Custom Action Filter that would put some object in the view data which your master page would always expect to be there. This action filter could also be used to fill in the common fields in your view model base class.

i would suggest using RenderAction rather than having a base viewmodel from which all your view models will inherit. i guess viewmodel that you want to use in your master page is most probably going to contain navigational data (menu or leftbar etc.). if this is the case, RenderAction places clean separation of concerns and you can cache the data used in this particular action after loading it for first time and your further request will then be served from cached data.

Related

How to construct multiple MVC in ios? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
It's well known that MVC is the only pattern in iOS. Currently, I'm developing a project with multiple MVCs, I'm confused about organizing these MVCs.
Basically, I have a survey MVC and a Question MVC. The sequence of display for the survey is:
An interface for user to key in title and description of survey
User clicks next to show the question interface
User clicks the next button to show another question interface and so on.
I'm thinking to have one model for the survey and one model for question. But How can I link the survey model to Question as I need an array of question in the survey model, which means the survey model depends on question model?
Please help me on this, thanks so much!
Your descreption seems a bit loosy. what you're describing is a Single MVC system where you have multiple views to :
Display survey.
Display questions.
and multiple modules to represent :
Survey object.
Question object.
you can easily use a UINavigationController with two or more UIViewControllers to build such app.
I suggest you to take a look at apple's Your second iOS App tutorial which is similar to what you're describing.
Hope that helps

NSNotificationCenter - Observer Pattern: Ok, but in mobile apps? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Why using NSNotificationCenter(ios) in a mobile apps. I mean I dont have many UI controls to update on a View. Also if I need to pass down to the caller of a View I would just use a delegate.
It might be justifiable in a logical sense if I have many Views in a Navigation control, and I would like to have each view down the navigation to update something - it is in situations like this NSNotificationCenter gets into play?
Thanks
Regards
In the situations you mention, you probably shouldn't use notifications -- it really doesn't have anything to do with mobile apps, the same criteria would apply to desktop apps as well. Notifications are best used if you need multiple objects to listen for an event, or in some cases, where two view controllers are far apart in the overall scheme of controllers, it's difficult to have one view controller set itself as the delegate of the other.

Update grails domain, controller and view classes [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am new to the Grails framework.
After taking it for a bit of a spin, I created my own domain class and used the generate-all functionality to generate the controllers and the views. After this, I modified (added some more required functionality and removed somethings that were not required) the generated controllers and views. The application runs without a trouble.
Next, I require to make certain changes to my domain class for which i have already created and customized controllers and views. After making the change to the domain class, is there any way (or what is the correct way) to re-generate the controllers and view classes with my previous updates intact.
Any help will be appreciated.
execute grails install-templates to install the templates and modify them (http://grails.org/doc/1.3.7/ref/Command%20Line/install-templates.html)
The next time you generate your view and/or controller, these changed templates will be used.

How MVC works in magento [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Thanks for the previous replies.
I am new to Magento and don't know how MVC operates in this framework. I want to display "Hello world" using MVC format--i.e., the controller imports the string from the model and transmits it to the view for display. Can anyone give me an idea of how MVC works in Magento?
This Magento MVC flowchart may assist
you can take the magento basics course for free today http://www.magentocommerce.com/services/on-demand
As we know, the implementation of a “Tier Model” is a large part of an MVC framework. It represents the details of your application and handles data in applications. Magento Models play an even greater role, because they usually contain the “Business Logic”.
The Magento Object Relational Mapping (ORM) has very important role in the process of working with database. Here We will go deeply to understand ORM. You can follow:
Magneto Object Relational Mapping ORM
MVC Developers - Magneto Models and ORM Basics
The only thing different in Magento's MVC model that is different from other MVCs is the way it use Block.
In normal MVC, variables are passed to the View through Controller. However, in Magento, Views get data from Block, and Block gets its data from Model.

Print Page functionality in MVC [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Anyone done this in MVC? any info would be great!.
Thanks.
You can get pretty far simply by including a print.css file for media type print.
Hide everything you don't want and include logical page breaks and demensions (inches, etc... actually format more correctly using the print.css override).
I have used a custom controller (or filter) to handle links using something like index.print instead of index.html, which simply overrides the master layout with a layout more suitable for printing, but I still feel that the alternate stylesheet is the best way to go.
http://www.alistapart.com/articles/goingtoprint/
Printing a page isn't really a matter for ASP .NET or MVC. Printing is a client-side operation, and therefore can (and should) be done entirely in client-side code. JavaScript has a method call for this:
window.print()

Resources