mvc

Codeigniter Session databse

Hello, I am trying to build a system the remebers the users interactions with website, for example my site allows the users to build there own navigation system, but I want the system to be able to remember the navigations system they choose with out the user having to sign up, I assume I need to user sessions/cookies for these, and fu...

Method name containing a dash?

How can I create a method that contains a dash in the name? public void my-method-name() { } ...

What's the best way to return an "Unauthenticated" message from a controller action to an Ajax request object?

I have a C# MVC application that relies heavily on Ajax. I am using the Ext JavaScript framework but that's not important here. If a logged on user is on a page and their session times out I need to inform the user this has happened at their very next Ajax request. For example there is a combo box that does an auto search and displays...

How do you model form changes under Spring MVC?

Please bare with me as I try to abstract this problem. Say your writing a web page for fruit vendors using Spring MVC's SimpleFormController, version 2.5.6. On this page the vendor can do simple things like change their name or their address. They can also change their inventory based on a drop down list filled with present inventory se...

Spark-View-Engine with ASP.NET MVC2

How do you modify a ASP.NET MVC 2.0 project to work with the Spark View Engine? I tried like described here: http://dotnetslackers.com/articles/aspnet/installing-the-spark-view-engine-into-asp-net-mvc-2-preview-2.aspx But somehow it still tries to route to .aspx files. Here the code of my global.asax: public class MvcApplication : Sy...

How to convince fellow developers that the in-house framework is no good

Here's the story: I have moved to a new job 3 months ago. The development team consists of 5-6 people, with one lead developer. All of the projects here are "one-man-jobs", there are no tasks requiring teamwork, everyone works on their own. Management wants us to use an in-house framework, so that the projects where there will be more t...

Where does input validation belong in an MVC application?

I have a MVC application that receives an input from a form. This is a login form so the only validation that is necessary is to check whether the input is non-empty. Right now before I pass it to the model I validate it in the controller. Is this a best practice or not? Does it belong to the model? ...

Where can I find all of the "things" Data Annotation can do (Validation)

Where do they list the attribute (things that you can do with the Data Annotation validation framework). Like, [Required] .... ...

ASP.NET MVC twitter/myspace style routing

Hi guys, This is my first post after being a long-time lurker - so please be gentle :-) I have a website similar to twitter, in that people can sign up and choose a 'friendly url', so on my site they would have something like: mydomain.com/benjones I also have root level static pages such as: mydomain.com/about and of course my hom...

jquery ajax call for asp.net mvc application getting two unauthorized reponses then Ok

I am executing the following jquery ajax call to an asp.net mvc controller which works, however on the firebug console it seems it is getting executed three times. The first two times it returns 401 Unauthorized and the final time it return 200 Ok. Could anyone shed some light on what is happening when I make this request and how I could...

Storing and retrieving images with MVC and Sql Server

I am designing an prototyping an app the needs to store images, similar to facebook. This will be a public facing site and I am not sure how many users I will end up with but what I am looking for is a way to efficiently retrieve them. So far I am thinking of storing them in SQL Server varbinary columns. Is this a good idea? I have the ...

checkout process workflow, having issues with redirects

My checkout process has the following workflow: checkout page shipping address edit shipping address(add/edit) delivery method payment place order Each of the above steps has its own action in the same controller. Now the issue is, if the person gets to #5, and wants to edit the address, they go back to #3. But when they hit submit,...

Cookie not saving

On my site the user is greeted with a yes/no menu what determines whether they see it, is this peiece of code. if(!isset($_COOKIE['bangUser'])) { // Get createRandomId() method and return a unique ID for the user $unique = ''; // Setting the cookie, name = bangUser, the cookie will expire after 30 day...

ASP.NET MVC radiobutton not working in the parent view to call partial view

Hi I have two strongly Typed partial views (Developers list and Testers list) and the respective views are Developers.ascx and Testers.ascx Now I want to load one partial view based on the radiobutton selected. The below code is not working on radio button change. Code Snippet: $('input:radio[name=Type]').change(function() { var u...

Avoiding large controllers in MVC

Controllers can become large and unwieldy when they contain large numbers of actions. Is this a significant problem in real-world use, and if so what are the strategies to mitigate it (or is is good enough to simply keep the action-count down per controller)? Off the top of my head I can envisage the controller offloading the logic to a...

Refactoring an algorithm

I'm trying to re-implement ASP.NET MVC routing rules in C++ for my own MVC application. Currently the code takes at least O(N) at best case and more if accessing the controller/action inside an unordered_map is not O(1). I would like my code to prefer a route with a controller that's already in the URI, for instance if the current URI is...

ASP.NET MVC Is it possible to use ascx files across multiple views with different Models

Hi All, I am wondering if it is possible to wrap up an ascx file so that it can be used in different views, without having to type it to a specific Model. This would mean you could use one ascx file for many pages, as long as the relevant model data was passed in. Currently I'm duplicating my ascx files for different parts of the site...

Override a static method

I am extending a new class by inheriting from RolesService. In RolesService I have a static methog that I would like to override in my newly derived class. When I make the call from my derived object it does not use the overridden static method it actually calls the base class method. Any ideas? public class RolesService : IRolesServi...

ASP.net MVC Get only the selected rows (checkbox)

We are using asp.net mvc and having trouble in selecting the list of approved orders. the orders are approved by selecting the checkbox against each order. eg.. Order id Product Is Approved 1 book (depends if the user selects checkbox or not) 2 pen (depends if the user selects ch...

Can you/should you modify objects in the database in the model of other classes

I want to perform some delete() and some save() methods on some objects that are not an instance of the current class I'm in. I'm trying to do this in an overloaded save() method of a class. Here is the scenerio: class Item(models.Model): name = models.CharField(max_length=500) category = models.ForeignKey(Category, null=True,...