mvc

How can I redirect an existing ASP.NET MVC route to another (using HTTP 301)?

I have a route: routes.MapRoute( "Company", "{id}/{name}.aspx", new { controller = "Company", action = "CompanyIndex" } ); I need redirect to the same URL, but without ".aspx" extension: routes.MapRoute( "Company", "{id}/{name}", new { controller = "Company", action = "C...

.NET/MVC JSON response opens up dialog box to save

I am trying to submit a form via jquery's ajax method in my .net mvc application. I've set the dataType to json and the contentType to "application/json; charset=utf-8". In my controller action, I'm returning a JsonResult. For some reason, the JSON response doesn't get handled correctly and instead I get a dialog box to save a file ...

ASP.NET MVC - POSTing to another page?

This might be a stupid question... I have a view which posts back to the controller. I want the controller to now POST to another page with certain parameters instead of sending a 300(Redirect) to the browser? I want to persist a value which I don't want to output int he query string. ...

One input box, many possibilities...in Rails

I have an input box which I want to handle two types of information, foo and bar. The form action is set to either the foo controller or 'bar controller. It really doesn't matter which one. For the sake of example, the form action is to foo/new. In the controller, I have a function that looks at the form input text and determines if i...

How to share code between model and controller in Rails?

Both my Rails model and controller code need to write files to the file system. I would like to consolidate the logic into one method. What's the best way to share this method across models and controllers? Thanks! ...

MVC with Microsoft and Oracle

I am curious about the strategies adopted by the two leading vendors on MVC. Whereas microsoft has currently unvieled MVC 2 and Oracle seems to have Oracle ADF which is based on Java and JSF but provides darg and drop functionality . Does this mean in the MVC race because of Oracle ADF drag and drop they are ahead of microsoft in this ?...

Basic Problem with Asp.net MVC UpdateModel(myClass)

In my Controller in a Asp.net MVC 1 app I want to use UpdateModel to populate a variable with POST data in my controller. I've looked at dozens of examples but even the most basic ones seem to fail silently for me. Here's a very basic example that's just not working. What am I doing wrong? public class TestInfo { pub...

ASP.Net MVC, ORM and "heavy" objects

Hi all, i think this issue is common in web applications with a middle-sized model. Let's say I have a SportCenter class holding a list of BasketballField, when showing reservations or properties of a BasketballField I still want to show few information about the SportCenter it belongs to. I'm using ASP.Net MVC and nHibernate for the da...

Is it bad practice to put view code in the controller?

In MVC (such as JSP and Spring), is it bad practice to view related code in the controller? In my case, the controller does some work and then hands off the results to the view (JSP). In the case of a status message, I can pass the entire message text to the view, or pass a key and let the JSP map it to the message text. Example: Mess...

Project structure recommendation for an opensource asp.net mvc project.

What do you think of the project structure for an opensource CMS application built on asp.net mvc application? The project nickname is "Gol". The basic requirements are outlined in the following posts. Ideas for OpenSource CMS in ASP.NET MVC Currently I am thinking of laying it down like this... Gol.Core.Session (contains session ...

How to write static file from ActionMailer::receive() w/o duplicating code in Rails?

I'm facing the following challenge for a Rails project: When a user receives mail, I want to invoke a method that writes the message out to a static file. The trick is, the mail needs to be embedded in a styled HTML page (i.e., we will surround the actual message with other page elements and style the whole page). Here's the current a...

ASP.NET MVC 2 Preview 1 - DataAnnotation Validation with complex model object

The ability to let the model handle its own validation has lead me to begin playing with the MVC 2 preview release. So far, I like the simplicity of the validation scheme. However, I have run into a roadblock. This validation style works fine for simple view model objects. For example if I have a model object named car and I'm lookin...

ASP.NET model binding to ProfileCommon

I'm wondering if there is a good example of how to edit ASP.NET Profile settings in MVC using model binding. Currently I have: a custom ProfileCommon class derived from ProfileBase. a strongly typed view (of type ProfileCommon) get and post actions on the controller that work with ProfileCommon and the associated view. (see code bel...

Ajax refresh messes up jqModal functionality

I am trying to use jqModal in my .net/mvc app to do simple jquery modal popups. I have a table where I list out records and have an "edit" button to popup a modal dialog to do the edits. When I submit, I hide the modal popup and refresh the table listing below using the .ajax() method. However, now when I click on the "edit" page, jqM...

How to efficiently select a subset of rows of a QTableView that match certain criteria?

I have a QTableView using a QSqlTableModel. In the underlying database (postgresql) table there is a timestamp column. How can I select all rows in the selection model where the underlying timestamp column is NULL? Pointers in the right direction would help. UPDATE: The main issue I have been having is performance. Each method I ha...

ASP.NET MVC form processing problem

Hi, I have the following action in my controller: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(int id, FormCollection formCollection) { // do stuff with form collection } this works fine. my problem is that when i use a view model object (say MyFormViewModel) no properties contain any form details. e...

How would you get this done with Telerik asp.net mvc extensions? accordion, tabs and ajax

I know this probably is a fairly complicated question but... heres my case: I want to build my UI using teleriks jquery ui extensions. My idea was to create a sidebar with an accordion and the main content with tabs. The accordion having as content a list of links. Each link mapping to correspond to an item of the accordion. For instanc...

asp.net MVC partial view controller action

Hi guys I'm very new to web app development and I thought I would start with recent technology and so I'm trying to learn asp.net aswell as the MVC framework design pattern at once. This is probably a very simple question for you mvc pros. My question is should a partial view have an associated action, and if so, does this action get in...

MVC: pass model / model data to a view from a controller?

If a view needs to acces data from a model, do you think the controller should: a) pass the model to the view b) pass the data of the model to the view c) neither; it shouldn't be the controllers concern. Let the view access the model directly to retrieve the data. Only let the controller give some parameters the view needs to filter th...

MVC beginner question - editing many-to-many relations

I'm using CakePHP to build an application using the MVC Pattern, but my question is language agnostic, I guess. Here's an overview of a part of my data: ITEMS (id, name, description) LOCATIONS (id, name) The items table describes a type of item ("apple", "orange", "banana"), not individual items. Each location can have any number of...