mvc

MVC Routing - Parameter names question.

Hello there! I'm looking for some information on Routing in MVC with C#. I'm currently very aware of the basics of routing in MVC, but what i'm looking for is somewhat difficult to find. Effectively, what I want to find is a way of defining a single route that takes a single parameter. The common examples I have found online is all b...

Does passing the params collection from controller to model break MVC?

I want to pass the params collection from the controller to the model to parse filtering and sorting conditions. Does having a method in the model that takes the params from the controller break MVC? ...

Where does form processing logic belong in a MVC web application?

In a web-based application that uses the Model-View-Controller design pattern, the logic relating to processing form submissions seems to belong somewhere in between the Model layer and the Controller layer. This is especially true in the case of a complex form (i.e. where form processing goes well beyond simple CRUD operations). What's...

How to get R# not to reformat ASP.NET MVC Spaghetti code

When I'm writing spaghetti code in my MVC views, R# keeps automatically dropping my braces to the next line and indenting and such. Is there a way I can turn this off for just my view pages? ...

MVC & RadioButtonList

I tried doing this but this only display the radiobutton without text beside it.. <% foreach (string s in Html.RadioButtonList("rbl")) {%> <% =s %> <% } %> ...

Is there an ASP.Net MVC view engine that supports JavaScript views?

I would like to generate some JavaScript on the server side in ASP.Net MVC. Is there a view engine that supports this? Ideally I would like to be able to get JavaScript from an url like: http://myapp/controller/action.js I've looked at the MonoRail project, and they seem to have this feature, but it's very lacking in documentation, a...

How do I reduce view duplication between client and server?

I'm working on an AJAXy project (Dojo and Rails, if the particulars matter). There are several places where the user should be able to sort, group, and filter results. There are also places where a user fills out a short form and the resulting item gets added to a list on the same page. The non-AJAXy implementation works fine -- the v...

Do you have a modeling notation that you use for MVC?

Hopefully (but not necessarily) one that is independent of language or framework? ...

Domain Logic and Data Access of MVC at Remote API/Web Service Layer

Hi all, In our system, we have a Remote API layer (e.g. SOAP, XML-RPC, REST, etc.) to handle the domain logic and data access for web application and any client applications that're developed on top of it. Unlike in the past, I do not have business logic code and DB connectivity at the web application, all user actions are translated to...

How abstracted should MVC models be?

I'm in the process of extending and improving a website that has quite a few structural problems. It looks very much like the developers before me had heard of MVC but didn't understand the ideas of abstraction or modularity. So the MVC "framework" is a) bespoke b) broken c) patched and d) there are several in use all at once. I intend t...

How can I trick MVC into rendering links based on a different virtual path?

I'm running a bunch of apps on discountasp.net with the subdomain addon. Since with shared hosting I can't have multiple IIS sites, I've also written an HTTP module that allows sites in subfolders to operate as if they are running in the root directory. So for example, instead of hosting my blog at dandoes.net/blog, I can host it at blog...

How should I structure a simple ASP.NET MVC app?

I've been reading a few things about ASP.NET MVC, SOLID and so on, and I am trying to figure out a simple "recipe" for small-to-medium ASP.NET MVC apps that would put these concepts together; the issue that I am most concerned with is ending up with controllers that are too complex and being like code-behind files in webforms, with all t...

Data validation in DAL vs. Business Layer?

Typically I have added data validation, such as checking that an input is within a certain range, in the data models found in my Data Access Layer. Searching the web I've seen that there are two schools of thought on the matter: Adding the validation as part of the Data Access Layer (like I have been doing) Adding the validation as pa...

Account based lookup in ASP.NET

I'm looking at using ASP.NET for a new SaaS service, but for the love of me I can't seem to figure out how to do account lookups based on subdomains like most SaaS applications (e.g. 37Signals) do. For example, if I offer yourname.mysite.com, then how would I use ASP.NET (MVC specifically) to extract the subdomain so I can load the righ...

Solution Structure and Restful ASP.NET MVC

In making a restful ASP.NET MVC app I'm wondering about the best way to structure the projects in my solution. By convention, the controllers reside in the same project as the views. However, if I have a few different presentation tiers accessing my restful controllers, would it be better to put my controllers in a layer (project) lower ...

ASP.NET MVC - How to explain it?

I am trying to teach ASP.NET MVC to students (undergrads) that have been studying ASP.NET for the last 8 weeks (I know that doesn't sound like much time, but the class is 4 hours per day, 5 days per week with Labs, Quizzes, Exams, and Wrestles). I haven't gotten the question yet...but I know it is coming... When would I use MVC instead...

ASP.NET MVC Views - Can I use code-behind

I am new to MVC and I notice that the view pages can look pretty nasty with all the intermixed script tags. Does it make sense to generate the HTML in a method in the view code-behind and then just insert the string result of the method as a single bit of script? For example: <div><%= GenerateTonsOfHTMLFromSomeIEnumerable() %></div> Is...

ASP.Net MVC HandleError throwing 500 Internal Server Error

Hi folks I have the following HandleError filter on my controller: [HandleError(ExceptionType = typeof(ArgumentException), View = "DestinationError")] I've set-up the Web.Config so that customErrors are on. The problem I'm having is that the HandleError filter is working fine, when I run the app locally out of Visual Studio, but when...

[MVC] What's the preferred URL to add an entity that is not an aggregate root?

Example: an Order object (aggregate root) has a collection of OrderLine objects (child entities). What's the URL add an OrderLine to an Order? Take into consideration the difference between using the aggregate roots' controller and having a separate controller for the child entity. 1: http://example.com/orders/add-orderline?order-id=42&...

MVC using ASP.NET webforms

I've inherited an ASP.NET application built on top of webforms, and the application suffers from having all of its business logic embedded in the codebehind. As a result, this application can't be unit tested. I want to break out the functionality of every form into an MVC style, but I've found that ASP.NET resists every effort on my pa...