mvc

How does ASP.NET MVC make it easier to create purpose-built, content/device-specific views?

One of the benefits of ASP.NET MVC I keep reading about is that it's easier (than with traditional ASP.NET) to create content-specific and/or device-specific views, e.g. straight HTML or JSON or XML or iPhone-targed HTML, etc. I do see how the more structured separation of view logic from controller logic facilitates this. Let's assu...

Qt: New student to Qt questions

I've got a class I've written, and I'm trying to connect it to Qt. I've got some "best practices" questions I hope you all can help me with. When creating a mainWindow to contain data, I inherit the header file into my custom class specified above, so I can make use of the elements created within Qt Creator. Is this the proper way of...

Unable to resolve uploaded images paths in partial view on server.

My ASP.NET MVC web app requires the upload of image files. These image files are then displayed via a partial view rendering where the path of the image file is inserted into the scr parm of the image tag. This works great in development mode however when I deploy to the server the images won't display. I have tried many way to specify t...

Quick question about MVC in Php

Currently, I am working on restructuring an existing code base. I'm new to php frameworks, but I do know in general how MVC works. Right now, there is one controller file, one model file, and thirty view files. Should every model correspond to a table? Should every view correspond to an html page? What about the controller? How can I...

User roles - why not store in session?

I'm porting an ASP.NET application to MVC and need to store two items relating to an authenitcated user: a list of roles and a list of visible item IDs, to determine what the user can or cannot see. We've used WSE with a web service in the past and this made things unbelievably complex and impossible to debug properly. Now we're ditc...

A minimal MVC setup for ASP.NET 2.0

I have to migrate a web application I made with ASP.NET MVC to a regular Visual Studio 2005 ASP.NET Web Forms based website. I've looked at things like MonoRail, but it's too different for my co-workers (who are already uncomfortable with MVC) to use. I've read that the first version of ASP.NET MVC was made in an airplane flight, that'...

Should an MVC Controller and View have a 1 to 1 relationship?

I am currently using asp.NET MVC to build a Content Management System parts of a website and have the odious job of recreating all of my Views as Partial Views as it appears to be breaking the way the site map works. For example, my FAQAdminController has the Views: Index, AddFAQ, EditFAQ, ConfirmDeleteFAQ and these have to become parti...

User authentication in asp.net or mvc

How to check user change his ip or not by any method in asp.net or mvc ...

Debugging PHP-based MVC controller interactively

I'm trying to get indefero working on a webhost I'm running, and the /login URL simply appears to be redirecting back to the main controller. I assume I have a setup issue, and rather than bother the developers, I figure I can blunder through and figure it out. (I'm somewhat familiar with PHP). What I'm not familiar with, is if there'...

Call a JavaScript function from a texbox that is generated by an MVC Helper.

How do I call a JavaScript function from a texbox that is generated by an MVC Helper. I want my textbox to call a function like this: <input type="text" id="Ejemplo" onkeyup="SumaEjemplo()" /> I'm using: <%= Html.TextBox("Ejemplo")%> Where do I put it? ...

Paging through search results with markers on a map

My search interface returns pages of results with each page of results in a separate div. i.e. <div id="page1"> result 1 result 2 result 3 result 4 result 5 </div> <div id="page2"> result 6 result 7 result 8 result 9 result 10 </div> etc. I'm generating this dynamically using ASP.NET MVC. I'm paging using jquery to hide all these d...

Why is my Fluent nHibernate repository (randomly) updating my domain entities?

We use the Fluent nHibernate repository model in a .net MVC project that I'm working on. While running a sql profile to check for areas of improvement we noticed that some objects were getting UPDATEd without an explicit Save. Does anybody know why nHibernate would choose to update an object when I select it? Class: public class Req...

Add months to a date using jQuery

I have a simple MVC form with the following elements: <%= Html.TextBox("FechaInicio") %> Which has the start date. <%= Html.TextBox("Meses") %> Which has the amount of months I want to add. I'd like to take the date that has been entered on the first textbox, add the amount of months that have been entered on the second textbox an...

Where do you "Load Balance" an ORM in a PHP MVC Application

The Problem: Object models built using an ORM often need to perform multiple queries to perform a single action. For example a "get" action may pull information from multiple tables, particularly when you have a nested object structure. On complicated requests these queries can add up and your database will start blocking long before it...

ASP.NET MVC Search Form with Pagination

Im at a loss for words, as I must be missing something. Just finished ASP.NET MVC 1.0 (WROX) and Im trying to implement a view that performs a simple search then renders the results in a table. I would then like to be able to page thru the results. So I have a search action from ListingsController, takes some values from FormCollection ...

Why use a templating engine with a framework?

I recently discovered the PHP framework Kohana (which is awesome) and was reading a thread about using it in conjunction with a templating engine such as Smarty or Twig. My question is why bother? Surely an MCV framework, by definition, is a templating engine. Even "raw" PHP is, arguably, a templating engine. What possible benefits are t...

how can I bust out of a PHP class initialization if the user isn't logged in?

I'm writing an admin section to a site using CodeIgniter. I am writing an Admin class that extends the Controller class, and then controllers for admin pages will extend Admin. I do this because I want the Admin class to check the user's session to make sure he is logged in -- and if not, to show the login page and abort initialization o...

How can I test an event of a MVC controller

I want to test the OnException, OnActionExecuted event of an MVC controller. If I use mock like this: var httpContext = MockRepository.GenerateMock<HttpContextBase>(); var request = MockRepository.GenerateMock<HttpRequestBase>(); httpContext.Expect(c => c.Request).Return(request).Repeat.AtLeastOnce(); r...

System.Web.Mvc.Controller Initialize

Hi, i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (something == true) RedirectToAction("DoSomething", "Section"); base.Initialize(requestContext); } } Basically, all my controllers will derive f...

Show error message using popup in a mvc project

Hi. I want to create an error handler for a mvc project, but the error message should be displayed in a popup. I tried to override onException event of the controller, but I don't know how to get back to the initial page and show the popup. I don't want to be redirected to an error page. Any advices? ...