mvc

What should you name your controller in MVC? When should you create a new one?

I have a question that really applies to any MVC framework, I'm using the Zend Framework MVC. When exactly should you create a new controller? What exactly should the Controller layer define? I've created several apps with the MVC, progressively becoming more reusable, but I've always struggled with naming Controller classes. For t...

MVC-like UI updates in Javascript/jQuery: best practices?

I'm coming across a bit of an awkward problem. I have a Web page with quite a few buttons on it that need to be disabled and enabled at various points. Now if this were a Swing (or any otehr desktop UI interface for that matter), it would be quite trivial: I would simply add listeners for the model changes I was interested in and updat...

Repository Pattern: What is the 'right size'?

I'm building some repositories for an MVC application, and I'm trying to come up with the right way to divide responsibilities between repositories. In most cases, this is obvious. But there is one particular case where I'm not sure what the right answer is. The users of this application need to track multiple types of time for their em...

When should I avoid using strongly typed viewdata?

I'm enjoying the lack of "magic strings" in my views and controllers but are there any draw backs to this approach? It doesn't seem like there are. I've read blog entries here and there implying otherwise though. ...

Modular web site with zend framework, stack of actions

How to build modular web site with Zend framework. I have pages in db, every page is represented as url. Every page has 1toN contents. Every content has controller, action and position (+other now not important columns). So, one request is one page and multiple contents (multiple actions). How can I build all actions before the output? I...

MVP/MVC vs traditional n-tier approach for winform apps.

We have a large suite of apps, most are C# 1.1, but at least 10 major ones are in VB6. We are undertaking a project to bring up the VB6 apps to .NET 3.5. All the c# 1.1 apps are written using a traditional n-Tier approach. There isn't really any architecture/separation to the UI layer. Most of the code just responds to events and g...

How to maintain state of Html.Listbox() in ASP.NET MVC

Hi, I have just started wrking on Asp.net MVC. For filtering a table i am using a Html.listbox() to select multiple items and a button to apply filter on the table. <%=Html.ListBox("CategoryOptions", new MultiSelectList(TypeModel.Category))%> But after clicking the filter button ,the listbox doesn't show(maintain) the items as s...

Passing variables to a view using Asp.net mvc and jQuery load()

Hi I'm currently loading a view(ascx) into a div using jQuery load(). I want to pass some variables to the view when loading it though so i'm using $.load(view, data); This does not seem to cause any problems but i have no idea how to access the Json object i'm passing in to the control. Here is the jQuery: var val = {"Id":"1"}; $("#D...

How to make a structure map powered viewengine in asp.net mvc

My views extend a base view class ive made: public class BaseView : ViewPage At the moment im calling ObjectFactory.GetInstance inside this class' constructor to get some interface implementations but id like to use structuremap to inject them as constructor arguments. Im using a structuremapcontrollerfactory to create my controllers...

ASP.NET MVC controller actions design question

I really like the way ASP.NET MVC works. I'd love to implement it on all new web projects moving forward, but I hit a snag in a prototype the other day that I really haven't found a good solution for, so I ask you, how would you design an MVC app that doesn't fit the typical REST pattern? As an example, the prototype I was designing woul...

Does MVC normally have a separate Controller for every View?

I'm just browsing MVC examples so far, and I think I'm getting a handle on it. For my project - an embedded system on ARM9, no Windows/ASP at all - we are considering doing all the UI as MVC. Does MVC also require a strict Tree of all UI Views (one root?) ...

Are there MVC embedded system GUI examples?

I'd like to apply the MVC pattern to a GUI we are developing for an embedded system. In this case my understanding is we would need to provide the underlying framework for listener/event actions between the Controller and View. Also, I have seen some examples where the Model send an event to the View, but perhaps that is not correct. Doe...

Best way to display model data in a master layout in an MVC framework

I have a simple rails app that uses a master layout for all pages. I would like to have a footer in this layout that displays data from the model, so that you can see the data no matter what page you are on. Currently I have only a single controller, with a few very simple views that are rendered into the layout with no action methods d...

Using google maps api in .net 3.5 MVC app

I have an MVC app which is pretty simple so far but I want to add a driving directions page to the clients location. I see plenty of examples using the traditional code behind model but none with MVC. The app uses master pages and content pages. I'm pretty new to MVC so bear with me. Any exaples of doing this would be much appreciated. ...

which mvc or engine should i start on?

i have been programming php modules and websites from scratch and building sites for customers is taking forver. people have told me to stick to an mvc or engine like (joomla,wordpress,drupal, etc). what I'm wondering is since i'm new to all this which one do you guys prefer i start with? an mvc or an engine (joomla,wordpress etc...) ...

Request a webpage with Cron

I have an MVC architecture and since I already have an action that would be extra useful if automatically called every hour or so, I wondered if there's a way to set it up as a cron job? ...

Registering ModelBinders

I have just updated to RC1 MVC from the beta product. I have the following code in my Application_start (in the global.ascx) System.Web.Mvc.ModelBinders.Binders[typeof(Shared.DO.Gig)] = new GigModelBinder(); This results in the following exception.... Method not found: 'System.Collections.Generic.IDictionary`2 System.Web.Mvc.ModelBin...

Now that I've set up Forms Authentication on my site, the stylesheet won't load!

I've set up Forms Authentication on my ASP.NET MVC website, including setting up appropriate entries in the web.config. Now every request to my site redirects to the Login page to authenticate the user. Problem is, this happens even when my pages try to access the master stylesheet (in the Content folder), so they end up rendering with...

Calling external .js from ASP.NET MVC

I'm javascript newbie. What I'd like to be able to do is to call a function from .js file sitting in ASP.NET MVC project's scripts folder. The function is: function myfunction() { alert("HELLO"); } ...and it resides in file brfix.js On a viewpage I call it like this: <script src="../../Scripts/brfix.js" type="text/javascript"><...

does an MVC Action have to return an actionResult?

Can a so called action in my controller just be a regular function that returns anything I want or does the return of an ActionResult declare whether its an "action" or not? I was wondering if i could call functions in my ActionLink in the "actionname" that didn't return actionresults. thx ...