mvc

Asp.Net Mvc Route problem

Hello, I have been testing a few options with Route Debugger but no luck. Let me describe what I am trying: I have all routes "translated" as follows (I needed to translate from English to Portuguese and sometime simplify): routes.MapRoute("Article.Create", "cms/artigo/criar", new { controller = "Article", action = "Cr...

Check session from a view in CodeIgniter

What is the best way to check session from a view in CodeIgniter, it shows no way in their user guide, otherwise I will have to make two views on everything, which is kinda weird...still a newbie to CodeIgniter... Please Help! Thanks... ...

How to test custom messages thrown back by a models validation in Rails

I have this validation in my user model. validates_uniqueness_of :email, :case_sensitive => false, :message => "Some funky message that ive cleverly written" In my tests I want to ensure that when a user enters a dupe email address that my message definately gets shown but without having to duplicate the error string from abov...

MVC in PHP without the "magic"

Let's say I have a PHP Model-View-Controller framework that maps an address like http://site.com/admin/posts/edit/5 to an action that looks like Posts_Controller::editAction($id) in file /admin/controllers/posts.php Now, many existing PHP frameworks that I've looked at would accomplish this by something similar to $module = Router::...

Accessing ASP.NET MVC Model Data from external Javascript file

Hi, I'm trying to use JQuery's $.getJSON to access Model data from the Controller, and build a JSON object in the javascript to use as the user adds and removes items from a list. All JS is done in an external file. The hit to the server for the Model data is done only once after the page first loads so I can get the full list of option...

Kohana Error... Attempt to assign property of non-object

So I'm trying to go through the Version 3 Guide of Kohana and keep getting an error on the hello world create view part. ErrorException [ Warning ]: Attempt to assign property of non-object Line 8: $this->template->message = 'hello world'; I placed the site.php in the application/views folder... is this the wrong place...? The code.....

What's the proper MVC way to do this....?

Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I'm actually using Kohana). I'm new to MVC and don't want to get this wrong... so I'm wondering if i have tables: categories, pages, notes I create a separate controller and view for each one...? So people can go to /category/# /page/# /note/# ...

An example of an MVC controller.. Please

I have been reading alot about how and why to use an MVC approach in an application. I have seen and understand examples of a Model, I have seen and understand examples of the View.... but I am STILL kind of fuzzy on the controller. I would really love to see a thorough enough example of a controller(s). (in PHP if possible, but any lang...

JQuery/MVC Search Issue

Hi All. This is not easy to explain so please bare with me. I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a list of fields - all 20 use the same controller but with a different GET for e...

.net c# order management library

I have the need for sql based library that will allow me to create products, order items, orders, etc to support e-commerce on a .net mvc site. Does anybody have a suggestion as to where I can purchase a library like this or should I write it myself? Thanks, Chris ...

ASP.NET MVC CheckBox

Hi there, I have an MVC view that displays a list of records. I want to have a check box that allows you to hide / show inactive records. How can I make it so that when the user checks / unchecks the box, it hits the controller and gets a full or subset list back? Should I use an AJAX call? Should all this be done on the Index method...

Easier way to find (visual) position of QModelIndex in QTreeView...

Greetings, I'm interested in calculating the physical position of a node in QTreeView and can't find a way to do this (other than calculating it myself, which is cumbersome and error prone given the robustness of QTreeView). Is there a standard way of finding the draw position of data associated with a QModelIndex (something similar to...

web2py (and other MVC frameworks): How to execute base code on all controllers

In web2py, is there a way to have a piece of common code be executed before all controllers are called? For example, I want to add some code that will log client IPs to a log of requests to enable analysis. I could simply make the first line of all my controllers be something like response = RequestBase(request) but I'm curious to kno...

Defining Views Based On Selection

Well the title isn't very descriptive but I'm not exactly sure how to explain but here goes! I have a web application (can use either MVC or standard web forms) which a user signs in to. If the user has signed up for more than one product they will have the option to switch between them. For the sakes of this example lets say User1 sig...

Unity: passing an instance of the model state to the injected dependency

Hi, I'm refactoring the controllers in a .net MVC app so I can inject the dependencies using the unity container. There's this service that needs a reference to the controller's modelstate so I'm hitting a roadblock here. Is it possible to get a reference to the controllers's modelstate at the time of the injection? I'm currently registe...

Should i create urls in the view or the controler?

I have user friendly urls that are generated and stored in a database.. When I want to get a url I have a helper class that gives me the urls.. this helper method sometimes calls to the database to generate a url.. According to separation of concerns should i generate all the urls needed in a page in the controller and pass them to...

Alternative paradigm for Mac OS X development

The current standard way of developing Mac OS X apps is with XCode/Objective-C/Interface Builder using the MVC paradigm. Is there an alternative? I'd like to use Interface Builder (XCode too) however I would rather use a different programming language. I come from .NET programming where you can delegate a click to a certain function, ...

Caching only the ActionResult in ASP.NET MVC

hi, I want to cache the ActionResult object that returns by a controller in asp.net mvc. So i created a ActionFilterAttribute subclass named ResultCacheAttribute that uses the HttpContext.Cache as the cache provider. The cache worked but it also alters the processing flow: now the view engine CreateView method won't be executed, instead ...

JTemplates format Date using asp.net mvc

Hi I have the following JSON date returned from a MVC page e.g. "DateProcessed":"\/Date(1258125238090)\/" and I am using JTemplates to process the data as below. $('#result').setTemplate($("#TemplateResultsTable").html()); $("#result").processTemplate(data); This is my results template <script type="text/html" id="TemplateResults...

Tests for Evaluating an Application Stack or Framework

I'm looking for a set of scenarios that can be used to assess the overall elegance, strengths and weaknesses of a given MVC framework. For instance, one such test could be how cleanly authorization is handled when it affects elements in the presentation layer. If the user has permission to see elements within an object, is that decision...