What are the best practices when it comes to mapping controllers to views? For example, say for the urls mysite.com/login and mysite.com/register...I can have my LoginController and a RegisterController map to Login/Index.aspx and Register/Index.aspx views. Alternatively, my HomeController could handle both of these and map them to Hom...
So, I personally think this is sort of whack.
I put a .aspx template in a nonstandard location. In this example, it has a virtual path of ~/Content/Sites/magical/Index.aspx.
I then created my own view engine as a test, which extends WebFormsViewEngine:
public class MagicalWebFormsViewEngine : WebFormViewEngine
{
public override ...
Hi Guys,
I am new to MVC and I have been following Steven Andersons Pro ASP.Net Mvc 2 framework book but have encountered the following issue.
The following line of code that sits in my site.Master file throws the following error:
<% Html.RenderAction("Menu", "Nav"); %>
{"Error executing child request for handler 'System.Web.Mvc.Htt...
When a user clicks on a link, I want to log some information. I can't do an AJAX request because if they clicked on a link, the page will unload (since they're going to a new page), and I don't want to force them to stay on the page until a synchronous event finishes.
So one idea I had was to add a parameter to the url. I.e. the urls w...
I have a route that looks like this:
new { controller = "ControllerName", action = "PhotoGallery", slug = "photo-gallery", filtertype = UrlParameter.Optional, filtervalue = UrlParameter.Optional, sku = UrlParameter.Optional}
and I have a form that looks like this:
<%using(Html.BeginForm("PhotoGallery", "ControllerName", FormMethod....
I am trying to create a pluggable ASP.NET MVC framework. I have extensively used Prism (CAB for silverlight) and am a huge fan and wish to implement the following items in my pluggable ASP.NET MVC framework
The framework will have a host to load the unity container and other infrastructure items like logging services and all.
Plugins w...
Hi guys
Wanted to ask a quick question regarding castle windsor and implementing IoC for Controllers in Areas. Does Castle 2.5 support MVC 2.0 areas?
My Castle config works ok for my root controller in the root of my site but any area controllers are not found with a
The IControllerFactory 'XXX.Castle.WindsorControllerFactory' did no...
I have a fairly standard MVC2 app running on 4.0 and under IIS6. I took the wildcard filter approach to route all requests to the asp.net ISAPI filter. So far so good.
I have now added some code to Application_Error in the global.asax to trap exceptions and email me the stack, etc. This also works fine.
But, I am receiving all kinds of...
Running asp.net mvc 2 on win 7 with .net 4.0
I have a controller action method that receives 2 DateTime objects from a form. The UI on the form uses the jQueryUi datepicker (not sure if that maters).
The user who fills out that form will ALWAYS be entering the date/time in Hawaiian time zone.
I want to convert that to UTC time and ...
Hi,
I'm using MVC 2. I have a question regarding client and server side validation. Lets say I have a class, and it has 3 properties as such:
[Required(ErrorMessage = "Required")]
public object Property1 { get; set; }
[Required(ErrorMessage = "Required")]
public object Property2 { get; set; }
[Required(ErrorMessage = "Required")]
p...
Hi,
I'm using MVC 2 and EF4. If have a view that displays my Application (class) properties. Not all the properties are displayed in the view. There are a couple of the properties that need to be set once the submit button is clicked.
I'm getting client validation to pass, but my server validation is still failing. I receive an App...
Hi,
I am coding an ASP.NET MVC 2 application that does the following:
A view is loaded. Clicking on a button opens a jQuery UI Dialog that loads a partial view inside of it. (it loads a brand new instance everytime the dialog is opened using the "load" method of jQuery dialog).
This partial view has a form (AjaxForm) that gets posted ...
I have created a localized MVC website using the code found on this blog by Alex Adamyan.
This is working great if I use an existing culture. However, I am trying to localize for Tagalog (tl or tl-PH). Windows does not have this culture built in so I have created one (I have tried both tl and tl-PH) as per the code below:
public stat...
I am making an application that deals with vehicles. I need two DropDownLists:
Makes: All Vehicle Makes
Models: Models that belong to the selected
value of the Make DropDownList
How is this done in MVC2?
My Idea: Do I use an ajax call when my first list is selected and then pull back the Models to bind to the Model DDL? How woul...
Using MVC and trying to use dependency injection for controllers, but when I try to call a method on a controller that takes a dependency, I get the "no parameterless constructor" error. Here's my setup:
ProductRepository : IProductRepository
ProductService : IProductService {
public ProductService(IProductRepository repository)...
The "Admin" area in my app contains a bunch of controllers, and it's a bit repetitive to put an [Authorize] attribute on all of them. Is there a way of telling the framework that all controllers in a certain area should have certain attributes?
Edit: Inheritance is not a solution in this case. First of all the controllers already inheri...
Hello,
I have a Windows Form project that I would like to migrate toward a web application using ASP.NET MVC2.
In this project I have some POCO classes as in this example that are part of a class library and that I would like to use with a binary reference
public class Person
{
public int PersonID { get; set; }
public string ...
I am building my first ASP.NET MVC site and this site needs to be in 2 languages.
When a user selects a language from the menu, the site would present itself in that language.
The content likely will be loaded all from resource files. Can I respond to a change in the culture definition at runtime so it load the correct resource file?
...
I want to have two partial views, one for SEARCH and one for SEARCHRESULTS.
I want to update SEARCHRESULTS when the "Search" Button is clicked on the SEARCH partial view form. SEARCHRESULTS needs to have the form data fed to it from the SEARCH partial view.
I'm not totally sure how to go about this. Can I update the SEARCHRESULTS par...
In an ASP.NET MVC2 app, we have the standard login action...
if (ValidateUser(model.Email, model.Password)
{
FormsAuthentication.SetAuthCookie(model.Email, model.RememberMe);
...
where the second parameter to SetAuthCookie is createPersistentCookie with the following documentation:
createPersistentCookie
Type: System.Boolean
...