controller

Use reflection to to see if Controller is within an Area

How do use reflection to determine whether a Controller of a given type is within a Area in an ASP.net MVC project? I am trying to write a new ControllerTypeResolver for an MvcSiteMap and need to work out if the type I am resolving exists within an Area in or not. ...

Can I use controller methods in a observer?

I need to refer to a controller method from a cache observer, How can I make it? ...

link to a controller function from the view

I have a function to take ownership of a job which updates the database to update the username in a table row. I want to link to this function from the view and then redirect to the appropriate page. How do you link to a controller function or a model function from the view? from the index i want to have another link beside show, edit...

Rails 2.3.8 How is 'id' passed to method in pagination example?

I'm working through "Learning Rails by Example" tutorial by Michael Hartl(11.33).The relevant code is: class PagesController < ApplicationController def home @title = "Home" if signed_in? @micropost = Micropost.new @feed_items = current_user.feed.paginate(:page => params[:page]) end end class User < ActiveRecord::Base def...

ASP.NET MVC 2 controller not cached

Hi All, I have amaster page that calls render action: <% Html.RenderAction("CategoryList", "Category", new { selectedCategoryId = Model.selectedCategoryId }); %> and the action looks like: [ChildActionOnly] [OutputCache(Duration = 10, VaryByParam = "none")] public ActionResult CategoryList(int? selectedCategoryId) { CategoryLi...

How to pass information from controller to viewdata? asp net mvc c#

I am building a pagination my mvc project and have follew problem. I did everything for pagination and now need just pass a page information to view data in view. I have a user control Pagination: Pagination.ascx: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Pagination.ascx.cs" Inherits="PIMP.Web.TestForum....

Unit testing functions with side effects?

Let's say you're writing a function to check if a page was reached by the appropriate URL. The page has a "canonical" stub - for example, while a page could be reached at stackoverflow.com/questions/123, we would prefer (for SEO reasons) to redirect it to stackoverflow.com/questions/123/how-do-i-move-the-turtle-in-logo - and the actual r...

Rails 3 rendering XML

I have Rails 3 application (running Rails RC1), and I have the following controller: class PluginsController < ApplicationController respond_to :html, :xml, :json def index @plugins = Plugin.all respond_with(@plugins) end end If I try to render http://localhost:3000/plugins it works fine, showing me the HTML version. If...

WCF service contract design. Is a use case controller appropriate?

First off, apologies if this question has been asked before but I couldn't find anything that answers this directly. Here's my problem. I've inherited a product which has been designed to be so flexible that populating pretty much every combobox and textblock on the (silverlight) form requires a service request. Some of the screens ta...

How should partials be loaded when they are dependent on business logic?

I'm using the term "partial" to refer to a small section of presentational code which is repeated on many views. For example, a sidebar. In vanilla PHP, where the business and presentation logic is mixed, including a sidebar is no trouble: if($someCondition) { include('sidebar.php'); } However, in an MVC design pattern, the presen...

How can I test if the current request is an ajax request in a Controller?

In some cases I'm sending jQuery.get() requests to an Action Method, and in other cases it's a browser request. Is there any way for me to differentiate between them so I can return different action results accordingly? ...

Cakephp call a function from another controller returns "Warning (512): SQL Error: 1064"

Hi, I'm sure this issue can be solved rapidly, but I don't find any answer on the web, so here I am. I want to call a function from another controller, but CakePHP does not recognize it as a function but as a query, returning a warning: Warning (512): SQL Error: 1064: You have an error in your SQL syntax; check the manual that correspo...

Reading Iframe content to controller on ruby on rails

Hi there, I'm trying to do something like that:(ruby in rails) I got an Iframe with content of two text lines example: **"bla bla Http://tt.tt"** How I read this content of the Iframe and set them as two keys in session. example: *session['firstline'] = "bla bla" Session['secondline'] = "Http://tt.tt"* I try'd to get the content...

Cakephp Route Top Level Request

Hi - I have a 1.2 app that I'm updating to 1.3. I need to send all top level requests like /foo to a controller action (/sites/view/$1) if they are not a valid controller. So in my 1.2 app I had a route like this (incredibly ugly I know): Router::connect('(?!admin|billings|carriers|clips|cliptypes|contacts|domains|faqs|leadcomments|...

TypeError: can't convert Post into Array

I'm using Rails 3 and will_paginate. Pagination works fine in my Posts controller but in my Tags controller I get an error on the second Tag id. Here's the error: TypeError in TagsController#show can't convert Post into Array ... app/controllers/tags_controller.rb:8:in `show' tags_controller.rb#show: def show @tag = ActsAsTaggab...

Issues with Relationships

You can take a look at the app I'm referring to at: http://github.com/585connor/QA So, I've built this question & answer app... kind of. I can get the answers to be listed on their respective questions but I cannot figure out how to get the user info to be displayed on those questions/answers. For example I'd like to put the username ne...

How to distory the view that added by pushViewController?

Hi, After adding a view by pushViewController method, there will be a back button in the navigation bar to pop out the view. However, seems that iOS won't distory the view after popping it out. When will it be distory? Can we distory it manually when popping out the view? thanks. ...

ASP.NET MVC File Uploading

HI there, My model (partial) public class Document : HttpPostedFileBase { public string DocumentTitle { get; set; } public string DocumentType { get; set; } My action [AcceptVerbs(HttpVerbs.Post)] public ActionResult AddDocumentToVault(Document model) { foreach (string upload in Request.Fi...

Autowired bean are not handled in my Controller bean (Spring-MVC)

Hi all, I create a Controller bean to map a dedicated URI. web.xml file : <!-- Spring MVC Servlet (that will route HTTP requests to BlazeDS) --> <servlet> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>co...

Billing Address is the same as Mailing Address

I'm using Spring MVC and have a page in my web application where I have a mailing address field that is mandatory and a radio button with a question asking 'Is the billing address the same as the mailing address?' Neither yes or no is selected by default to force the user to select an answer to the question via validation. I have curren...