This may not be the correct way to use controllers, but I did notice this problem and hadn't figured out a way to correct it.
public JsonResult SomeControllerAction() {
//The current method has the HttpContext just fine
bool currentIsNotNull = (this.HttpContext == null); //which is false
//creating a new instance of a...
In a visual studio 2008 project, how can one structure his controllers to accessible in the following directive?
http://localhost/MyWebsite/api/users/get/1
Both /api/ and /users/ are controllers "get" being a method of "users" with 1 as the parameter
Essentially I am talking about achieving REST i would assume.
Any ideas?
Thanks,
Ni...
Hi All,
I've written an application controller that handles 99% of what I need any controller to do. I've posted it here (pastebin). Like I said, feel free to be harsh.
-update: added comments :)
Thx,
-C
P.S. I would like to say that my intention here is to overwrite methods that need different functionality in sub-classed contro...
Designing a web app with a admin section and a public facing section. It feels like having a public facing controller just for "index" and "show" is a bit redundant. All the suggestions I've read suggest a namespace for admin, which is fine. I just wonder if I should have one controller with an addition action, say "list_public" or somet...
Important Update
Since the release of MVC 2.0 Preview 1 this feature has been implemented as the part of the actual framework itself in the form of Areas. More details available on Phil Haack's blog here
I have a controller called ListManagerController. This controller contain an ActionResult method called Index(). When I right ci...
In the NerdDinner tutorial, Step 5, mid way down under Complete Edit Action Method Implementations there is a paragraph:
The nice thing about our Edit implementation is that neither our Controller class nor our View template has to know anything about the specific validation or business rules being enforced by our Dinner model. We can...
Is it possible to display a view from another controller?
Say for example I have a CategoriesController and a Category/NotFound.aspx view. While in the CategoriesController I can easly return View("NotFound").
Now say I have a ProductsController and an action and view to add a product. However, this action requires that we have a Cat...
Hi,
When making Controllers, what are the best ways to split it up?
If I have an admin section that has a bunch of .ascx web user controls underneath it and a few .aspx pages. Should I have one AdminController? Or should I have a Controller for each individual admin pages/web user controls?
It seems as though being responsible for a s...
Say I called Index() from the HomeController which returns the view Index.aspx, can jquery ajax in javascript on Index.aspx call a method in another controller (ExternalController)?
$.ajax({
type: "POST",
url: "/Home/sayHi",
dataType: "json",
data:({ currRow : centerPost[0], offset : ((-1 ...
Hi All,
I've recently added activescaffold to an existing rails project, and the problem I'm having is that the variable names that activescaffold is using are not the same as the ones I already have. Rather than go through my entire application and change all of the instance variable names, I'd like to be able to set the instance varia...
UPDATE: Solved. Thanks BusyMark!
EDIT: This is revised based on the answer below from BushyMark. I think I made all the suggested changes correctly, but I still can't get the post_type_id to save to the database when a user submits a message.
My app has a profile page. On the profile page, the owner of the page can type an update and...
I'm developing an ASP.NET MVC application where the content for any page can be pulled from the database, if it exists, and displayed on the page.
This is to make it possible for non-technical persons to edit the content without having to go into the source code (e.g. views) and change things.
The way I'm doing this is, each controller...
I have a bunch of controllers in a namespace Foo.
I'd like to apply a before_filter 'require_user' to all of them, but not to other controllers, that do not belong to Foo namespace.
Is there any way to accomplish this besides explicitly invoking a before_filter method in each controller?
...
Hi Guys,
I'm getting the following error migrating my code across from my Windows dev machine to my linxu production machine. I'm aware there are always separator and case sensitivity issues (which I have fixed), however this one seems to be coming from the Framework itself.
My controllers are all following the convention (Uppercase f...
I need to create something similar to how MVC invokes an Method(Action) and also uses the Model Binder to map a NamedValueCollection to the parameters on that method. Basically I have a Controller action that needs to dynamically call a method on a class, the controller has any information sent in a form or query string plus the name of ...
I can't come up with a nice name for my admin related controllers.
I have a UserController that is used for the site (non-admin related actions). Now I created an ADMIN section that has the following url format:
www.example.com/admin/{controller}/{action}/{id}
My controller folder is layed out like:
/controllers/
/controllers/admin/...
Hello,
When typing in my URL
SalaryFor/Microsoft/Balmer
i need to display salary for user with name Balmer
and if I type in URL
SalaryFor/Microsoft
i need to display salary for all employee in Microsoft company
Is it possible?
because when I use this link
SalaryFor/Microsoft/Balmer
all works fine
public ActionResult Salary(strin...
Hi All,
I have a 3yr old application that has some controllers with some very unrestful actions. I'm trying to implement a new resource that has relationships to some of the older ones, but I want to use activescaffold to manage the nested resources rather than try to rewrite the plate of spaghetti that is the rest of the codebase. I ...
Using cakePHP my goal is to combine the index view of two or more controllers in one layout page.
Example:
I have controllers for: news, events, links.
I want to show the last five entries from each table in one layout page.
Also, when one of the links from the views is selected it should take the user to the respective view for that re...
I am new to gwt. I am trying to integrate gwt+grails.Can anybody provide me a good example for handling the request using grails controllers and not a custom servlet.I will be really thankful if anybody can guide me :)
...