asp.net-mvc

ASP.Net MVC - Why is a controller being created for favicon.ico?

I am using a custom ControllerFactory (to use Castle Windsor's IOC to create controllers), and I notice it's getting requests to create a controller for "favicon.ico". I have put a favicon.ico file in my Content folder, but I'm still getting these requests. How do I resolve this and serve static content without trying to create controll...

where should i start before using asp.net mvc?

Hai guys, As i want to develop an application using asp.net MVC, i dont know where should i start... I ve done some applications using asp.net webforms and now i want to make a move to asp.net mvc... ...

Could the projects name contain a dot?

Hi, I'm runing MVC 2RC project on IIS 5.1. When default created project is named "MvcApplication1" than everythig is ok. But when projects name is "MvcApplication1.Web" (contain ".") than I get an error during the debug: "unable to start debugging on the web server. the web server could not find the requested resource" Do someone know...

How to call Post method on DropDownList selection in ASP.Net MVC?

Hi all, can anyone please help me about how to invoke a post method on changing the drop down list selection? I have Index method in my controller which takes me to index page. There i have placed a dropdown list using Html.Dropdown containing items like 1,2,3,etc. I want to call post method for Index whenever i makes any selection from...

PartialView Validation

I am having this issue where I have a form in a partialview but when validating it jumps out of the parent view and appears on its own (having the submit action url). Also I tried with Render.Action, where validation does not fire at all. I am using ASP.NET MVC 2 RC and need the server-side validation to work, using the built in valida...

Why are there 2 constructors in the Default AccountController provided by the MVC ?

Hello, here's the default AccountController.cs that's generated by the framework. public class AccountController : Controller { public IFormsAuthentication FormsAuth { get; private set; } public IMembershipService MembershipService { get; private set; } public AccountController() : this(null, null) { } ...

mvc.net DateTime with Time part in URI

I have a set of actions that are returning time-series data with-in ranges specifiable to the minute. They work fine with querystrings, i.e. /mycontroller/myaction?from=20091201 10:31&to=20091202 10:34 with or without URL encoded colons, but I thought it would be nice to have a pretty URL /mycontroller/myaction/from-20091201 10:31/to-2...

MVC user created values -- Is reflection my only hope?

Is it possible to determine if a controller exists before attempting to return the View? In my scenerio, my action value in my URL represents a user created value, and the id represents the controller. i.e. http://mysite.com/systems/WIN1234/Configure ...where WIN1234 is dynamically routed to the Configure action. Because I would li...

Restore messed upp Assemblies Mvc VS2010

I've seem to have messed up my environment. When i create a MVC 2 Web Application project i face this error. Any idea of what i need to reinstall/uninstall? ...

How to cleanly add ?q= query parameters in ASP.NET MVC?

I want to use a simple URL query parameter to display customized confirmation messages like "Message sent" or "Message deleted". I want to model it similar to how Flickr does it. Their URLs look like http://www.flickr.com/photos/username/?success=1 and then show a success message. How do I go about doing this in ASP.NET MVC using a Cont...

error on submitting form when inserting <, > characters into inputs

I have a usual html form with text inputs inside of it, and everything works, but if I will insert some > < characters in a input than I get this error: A potentially dangerous Request.Form value was detected from the client anybody knows how to handle this stuff ...

how to allow for a flexible UI in ASP.NET MVC

We are starting a new ASP.NET MVC project and we would like to establish a pattern of development that will allow flexibility in the UI. The general idea is that we would like to develop a set of related controls as a unit (i.e. a set of inputs and a submit button) and maintain the flexibility to decide later 1 of 3 UI options Have t...

How could I modify this query to get what I want - Calendar dates

Hi I have this query return plannerDb.IndividualCalendars.Where(u => u.UserId == userId && u.StartDate.Date >= startDate && u.EndDate.Date <= endDate) so basically what this query does is that is looks for all calendar events that range from the start of that month to the end of that month. However this does not accou...

How to stop ASP.NET MVC ajax form POST responses from having their form fields reset?

I am using an AJAX form post to send some form fields to the server, where the data will be updated in the database, and is massaged in the process, so the data may change a bit on the server side. The response of this controller's action is a partial that updates the form field's HTML so that the values of those fields include the new ...

View Called from Partial Not Submitting Form Data

Hi! I hope I am able to put this question together well. In a partial view I have a link to a create action: public ActionResult CreateProject() { return View("EditProject", new Project()); } Now this loads another view which allows editing of the blank model passed to it. But when form is submitted it is supposed to post to: [Ac...

ASP.Net MVC Custom Error handling via Action Filter Attributes

I am trying to implement Custom Error handling via Action Filter Attributes. My code is as follows: [HandleError (Order = 2)] [HandleError (Order = 1, ExceptionType = typeof(NullReferenceException), View = "CustomError")] public class ArticlesController : Controller { public object OhDearACrash() { throw new Exception(...

The unit of work pattern within a asp.net mvc application

I have been looking at this excellant blog titled "NHibernate and the Unit of Work Pattern" and have a question regarding the best place to use UnitOfWork.Start in a asp.net mvc project. My SLN is broken down into the following projects:- MVC project Repository NHibernateUnitOfWork I have an interface:- public interface INameRep...

Entity Framework throwing InvalidOperationException when trying to load child tables

I am using Entity Framework with asp .net mvc. I have a repository class that initializes an instance of the entities in the constructor. Let's say I have the familiar customers table that has 1 to many rows in an orders table: Customer has many orders. I have tried the following 2 ways to load the orders associated with customer, but ...

DTO = ViewModel?

I'm using NHibernate to persist my domain objects. To keep things simple I'm using an ASP.NET MVC project as both my presentation layer, and my service layer. I want to return my domain objects in XML from my controller classes. After reading some posts here on StackOverflow I gather DTOs are the way to go. However, I've also come acros...

MVC - Displaying Content

How to Display the following public ActionResult Index() { IEnumerable<int> items = Enumerable.Range(1000, 5); ViewData["Collection"] = items; return View(); } in "View" <ul> <% foreach(int i in (IEnumerable)ViewData["Collection"]){ %> <li> <% =i.ToString(); }%> ...