controller

Scrolling down a page after rendering in Rails

Is there a way to scroll or jump down a page after rendering it? Specifically, in my controller action, there are some situations where I'll want to send the user to a particular place on the page. If it were just a link from another page, I'd probably use a URI fragment identifier - "http://blorg.com/page#id" - but this needs to be dy...

Accessing objects in different controllers while using different threads in cocoa

Hi, I'm pulling in xml using the cocoa NSXmlParser. Since this process most likely won't finish before my view is loaded I want to move it to a secondary thread like I have seen in many examples including the seismicxml example on the apple site. The flow of my application is as follows. I have a table view which cells can be clicked t...

How to switch between primary and secondary thread within different controllers in cocoa

Hi, I know I can create a separate thread in cocoa touch with the following code: [NSThread detachNewThreadSelector:@selector(getEarthquakeData) toTarget:self withObject:nil]; How to go back to the process of my primary thread? I know I can do this from the delegate with this code: [(id)[[UIApplication sharedApplication] ...

What defines the traditional "page" concept in MVC?

I currently use CodeIgniter as my framework of choice when using PHP. One of the things I am wrestling with is the idea of a "page" and how to represent that properly within MVC. To my knowledge, CodeIgniter has a front controller that delegates to page controllers. So in my thinking, each page would have it's own controller. But all...

getting route to controller action (url) programmatically

I have a controller named "AccountController" and action called "ResetPassword". From the html markup I can do something like: <%= Html.ActionLink("LinkText", "ResetPassword", "AccountController") %> and it will output the correct url. Is there a way to do this programmatically? I am trying to get the url as a string in another class...

How to create a strongly typed master page using a base controller in ASP.NET MVC

Following the NerdDinners example, I am interested in creating a strongly typed Master Page. In order to achieve this, I use a base controller which retrieves the data for the master page. All other controllers inherit this class. Similarly, I have ViewModels for the master page and any other views. The view ViewModel classes inherit fro...

How to load an xml file from the model when the ControllerContext is null in ASP.Net MVC

Hello. I have a base controller abstract class, which my other controllers inherit. This class needs to load a local xml file in order to create some buttons for the master page. Given that the ControllerContext is null at this stage, what is the best practice for loading the file? (When running on the webserver, I get the following erro...

Controller Path in ASP.NET-MVC

How do I get the path of a controller? For example, I can get the path of a HtmlHelper like this: private static string GetVirtualPath(HtmlHelper htmlhelper) { string virtualPath = null; TemplateControl tc = htmlhelper.ViewDataContainer as TemplateControl; if (tc != null) { virtualPath = tc.AppRelativeVirtualPath; } ...

iPhone - Difference between a Library UINavigationController and my subclassing UINavigationController

I'm trying to understand the difference between using a UINavigationController inside a Nib (via the library window) and subclassing the UINavigationController. (For the purposes of this question, I'm not just specifically referring to a Navigation Controller; I'm referring to any Controller that is contained in the Library window in Int...

Parameter binding of POST action method

You can see what GET Delete action method passes DDW2File object to view. Is it possible somehow to bind this object back to ddw2file parameter of POST Delete action method? Now I have null value in it. Code fragment: public class DDW2FileController : Controller { ... public ActionResult Delete(string fileName) { r...

how do i can swich the view based on the logged in user in mvc asp.net

I need to either redirect user or show not authorized page according to usertype of the logged in user. Here is some which would give you an idea. public ActionResult Index() { if (Request.Cookies["isadmin"].Value != "true") return View("NotAuthorized","Index"); else return Vi...

Accessing the list of Controllers/Actions in an ASP.NET MVC application

We know that behind the scenes, the ASP.NET MVC framework will use reflection to determine what controllers/actions are available to be executed, based on which classes derive from System.Web.Mvc.Controller and, of those classes, which methods return an ActionResult object. To my question - is it possible to access this list of control...

asp.net mvc multiple values to route

Hi guys, is there a way to send multiple parameters to controller as one parameter? for example, if I have route: {controller}/{action}/{languages} can parameter languages be array of strings? if it does, how to use it...how to send array to controller and how to parse it in controller method? thanks Marko ...

How to display content that differs across controllers and methods in application layout?

I'm trying to display a javascript feedback widget in my default application.rhtml in a rails app. It will only appear on a subset of pages, distributed across different controllers. Trying to figure out the best way to do this. One thought was to do something like this: <%= render :partial => "layouts/feedback_tab" if @show_feedb...

Should I use .erb or .rhtml files for a Rails app in which all Controller logic exists in Views?

I'm just starting to learn Rails. I created an empty Rails app. And instead of writing a Controller, I want to put all of my Controller logic in my Views instead of in separate Controller classes. To do this, should I use .erb files or .rhtml files and what's the difference? ...

Asp.Net MVC don't show Index action in url

I would like that the Index action doesn't appear in the url. For example, I would like to see www.mywebsite.com/MyController/1 instead of www.mywebsite.com/MyController/Index/1 Is there something special I have to do in the Html.ActionLink tag or in the global.aspx file ? ...

In Rails, how can you output the name of the action from inside the view?

If I render the update action from inside the create action, is there a way for the "update" view (i.e. update.html.erb) to know which action rendered it. I want the update view to print out the action name "create" when the create action renders it and print out the word "update" when the update action renders it. The problem is render ...

Opinion on Generic .Net Mvc Crud extensions

Dont know if you allowed to ask this sort of thing here... but as they say easier to ask for forgiveness rather than permission. I have dipped my toe into "giving back to the community" and would like people's opinion on the project. In short it is a colleciton of generic crud controller and repository classes and interfaces to automat...

What does this line of code mean?

Hey, What does this line of code mean? I do not understand it - (IBAction)edit { self.editingViewController.movie = self.movie; // I dont understand this line [self presentModalViewController:self.editingViewController animated:YES]; } And what about this? - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:ani...

Is scaffold no longer valid in the Controller definition?

class AdminController < ApplicationController scaffold :album end In a Rails 1.1.6 tutorial I was instructed to put the code "scaffold :album" inside my admin controller. This is a music application containing a model called "Album". This generated an error saying that scaffold is not a valid method. Is this a deprecated/obsole...