MVC :: Area Controller To Inherit "Shared" Controller?
Mar 11, 2010
Say I have several Areas that are baed on user roles.Differnet roles have different functionality, but also have some "shared" functionality like say "Payments"Now, I created a PaymentController (and it's views for listing, creating messages) in Shared (not an area) and it works fine.
Would it be possible (and how?) to create a PaymentsController class in one of the Areas, have that inherit the PaymentController Class in Shared?
If I can do this, I can successfully share common functionality across areas, and at the same time extend the derived controller to include some 'area specific' functionality to common shared controllers. (Such as the "REturn to xxxx" text and route of the returnurl, which are a bit more complicated than I just made it sound)
View 3 Replies
Similar Messages:
Dec 28, 2010
UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, that follows the UP(Unified Process). It uses a Grasp Controller pattern to interact with domain classes by some methods like NewSale(), AddNewItemToSale() and CloseSale. In windows form, I can instantiate a object of this class in the UI and then use its methods to perform the actions. This works well in Client apps, but when I use asp.net mvc, I cannot find a way to instantiate an object (one for each user) that was always visible for a Controller (MVC). I cannot insert as an attribute inside Controller because it always create a new one.
View 1 Replies
Mar 7, 2011
I'm writting an application where I want to execute some code before a controller is invoked, even before the controller is created. I would like to somehow hook into the request processing as early as possible after the request is parsed and the RouteData is available. I've tried to hook in by handling the BeginRequest event but at this point there is no RouteData. Is there another place I can look for the area when BeginRequest delivered or is there another place in the request processing pipe that I can hook in to find the area before my controller is invoked.
View 2 Replies
Dec 17, 2010
im trying to get the current nameof the controller within a partial view (under /shared/).
ViewContext.RouteData.Values["Controller"].ToString() worked well for me. But not with a partial view.
I call the partial view from /Admin/Details. But im getting /Admin/Details/Admin as result. Maybe this is a bug? Here is my code:
[Code]....
View 2 Replies
Nov 6, 2010
my MVC2 delete and only my delete controller is refusing to return any class information. Its really similar to my edit function and the views are all auto-generated so I don't see the problem.
Function Delete(ByVal id As Integer) As ActionResult
View 4 Replies
Aug 16, 2010
I have a simple model where a Person has Gifts. I have a view which is a list of Gifts belonging to one Person.
My problem is with the Create action for a new Gift. I want it to default to the PersonID that we are already viewing the list of Gifts for. I tried simply passing the last PersonID (they are all the same)
Html.ActionLink("Create New", "Create", new { id = Model.Last().PersonID }) which works fine if there is already at least one Gift for that person but if this is the first Gift I don't have a value.
My Gift List controller knows the PersonID I want to pass but the view doesn't.
How do I pass this PersonID from my Gift List controller to my Gift Create controller via the Gift List view? Or is there a better way to do this?
View 2 Replies
May 30, 2010
I have a filter on my MVC web site. I display some records in a few different controller actions but when moving from one action to another I want to apply those filter values.
How can I persist values from controller to controller?
Should I use Session? TempData?
I am using Structure Map for IOC.
Maybe I could have a class that contains a Property for each Session Value that I use in my application and inject it on the controllers that need session?
View 10 Replies
Mar 14, 2011
How do you get the current action / controller name in a controller or class?
i can't show it in my view but that's not what i want.
View 1 Replies
Mar 15, 2010
I'm creating an ASP.NET MVC 2 (RTM) project that uses areas. The Index action of the Home controller of one area needs to use RenderAction to generate a sub-section of the page. The action called is also defined in the same Home controller. So the call should just be:
<% Html.RenderAction("List") %>
However, I get an exception:A public action method 'List' was not found on controller 'RareBridge.Web.Areas.Events.Controllers.HomeController'.
Note that I'm not in the "Events" area! I'm in a completely different area. If I remove the "Events" home controller, then the exception still occurs but names a different controller (still not the one I want it to call).
I've also tried providing the controller name and area to the RenderAction method, but the same exception occurs. What is going on here?
BTW: I am using Autofac as my IoC container
View 2 Replies
Jul 22, 2010
C#: HomeController.vb: works fine HttpPost RsvpForm gets the object filled with user input.
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using RsvpInC.Models; namespace RsvpInC.Controllers{ public class HomeController : Controller { //
[code]...
View 5 Replies
Jan 24, 2011
I have a User entity and a department entity. I have a UserViewModel and DepartmentListModel which has List of departments.
UserViewModel has a property of type DepartmentListModel .
Now on user/create action I need to populate DepartmentListModel by calling DepartmentController's list action. List action returns populated DepartmentListViewModel.
From UserController how do I set DepartmentListModel ?
I tried doing so
[Code]....
But RedirectToAction returns RediretToRouteResult
View 7 Replies
Jan 19, 2011
How can i transfer control to a controller's method from a controller's method..I am having two Controllers Home and User.. After username and password are verified inHome Controllers method , i want to show the User Controllers index page , so i have to callindex method of Home controller..How can i do it.
View 5 Replies
Jan 12, 2011
I'm working on a web application that stores some Office document (and any other kind of doc) on a remote shared area. I need to allow user to view the files available on shared area using my web application, how can I do that? Some years ago I solved this issue with Java / JSP opening into an output streaming the file, how can I do the same with ASP.NET and VB.NET? there is another way to solve my issue?
This is how I organized my application:
C:Webapp -> Webapplication
emoteserversharedfolder -> shared area
The owner of IIS process is the only user that can write / read the shared area.
View 1 Replies
Nov 20, 2010
I have a View:
<div class="editor-field" id = "nick">Nick <%: Html.TextBoxFor(model => model.Nick)%><img src="/Content/Images/loading.gif" alt = "loading...."/>
<%: Ajax.ActionLink("Check", "Check", new AjaxOptions { UpdateTargetId = "check-valid", LoadingElementId = "loading"})%>
</div>
I used: Nick = ViewData.Model.Nick in ActionLink as below, but I cannot get value of Nick from View.
<%: Ajax.ActionLink("Check", "Check", new {Nick = ViewData.Model.Nick}, new AjaxOptions { UpdateTargetId = "check-valid", LoadingElementId = "loading"})%>
View 1 Replies
Sep 24, 2010
I have an edit application view, and it can be found at the following URL:
http://localhost:17262/Application/EditApplication/1
1 equals the application ID.
Also on the page I have a link that goes to another view to add an assistant for the application. I want to pass it the application ID so that the new assistant can be "linked" to this application. How would I get the value of 1 and add it to my action link? This is what I have in my HTML so far:
<%: Html.ActionLink("Add New Assistant", "Create", "Assistant", new { applicationID = "id" }, null) %>
View 1 Replies
Mar 13, 2010
I've added some custom properties via the <profile> node in the web.config. In a view, I can access the custom properties using <%= Html.Encode(Profile.CustomProperty) %> so I know the class is being automatically generated. However, in the Controller, the ProfileCommon just doesn't exist. Do I need to include a specific namespace for this to work or is it simply not supported?
View 1 Replies
Mar 21, 2011
I cant get to directcontroller url (I have change the routing so it will fit into my paging system but I cant fit it also to get the controller url without action (I can gethttp://localhost:51443/home/inde )but I would like to get also "clean" url like http://localhost:51443/home
[Code]...
View 6 Replies
Aug 25, 2010
I have a drop down where I want to pass the selected value I selected to the controller. How do I accomplish this?
View 2 Replies
Aug 20, 2010
I have this code in my view..
<%=Html.DropDownList("ProductTemplate",new SelectList(Model.ProductTemplate,"Value","Text"))%>
I know if this dropdownlist box is in between BeginForm submit I can able to access the value in Controller using collection["ProductTemplate"];
if it is not in my beginForm still I can able to access this selected value in controller?
View 2 Replies
Jan 7, 2011
i get an error: "The controller for path '/favicon.ico' was not found or does not implement IController"
then i thought: how does the framework know for which files it has to instantiate a controller, because the same thing is true for script, css and other files (never thought of that, but now the favicon is complaining, i was wondering....
View 3 Replies
Nov 15, 2010
I have an action:
public ActionResult Details(int? aaaID, int? bbbID)
and I am trying to route the url http://..../controller/aaa/23432 to action Details.
routes.MapRoute( "controller", // Route name "controller/aaa/{id}", // URL with parameters new { controller = "controller", action = "Details", lblID = UrlParameter.Optional } // Parameter defaults);However, the aaaID of function Details also get a null value?
View 1 Replies
Nov 21, 2010
I have 2 repository that I'm trying to use in the same controller and cant find out how
This is what I'm tried :
[Code]....
for the first one it was working(VortRepository but I cant add the second )
View 5 Replies
Dec 17, 2010
I'm embarrassed to ask this question, but not sure what the syntax is to call a URL from within a controller (not associated with the application).
The reason I need to do this is because I am sharing authentication with another webforms app and would like to clear out the session variables before rerouting to that other URL. I'm just not sure of the syntax to route from an Action method to a URL like www.microsoft.com?
View 2 Replies
Sep 25, 2010
I am using MVC 2.
I have 2 controllers called Application and Note. The application is a loan application. A note can be added to an application.
On my Index I have a grid that displays all the applications, and an action column with a link that says "Add Note".
In my Application controller I have action methods for create and edit. In my Note controller I have action methods for create, edit and delete.
I was wondering if the following is possible when the user clicks on the "Add Note" link to go to a URL like:
Application/1/Note/Create
1 is the application ID. Note would be the Note controller, and Create is the action method in the Note controller. Is something like this possible?
I started with the mapping in my global.asax, but not sure if it is correct:
routes.MapRoute(
null,
"Application/{ApplicationID}/{controller}/{action}",
new { controller = "Note", action = "Create" });
How would I create the link in my grid using the action link?
EDIT:
The grid above is on my Index view in my Home direcotry. So on this grid I need to concatenate the link to display as above. I'm struggling to create this link on my Index view. It's not concatenating correctly. Currently I have this:
Html.ActionLink("Add Note", "Create", "Note", new { ApplicationID = c.ApplicationID }, null)
And it is displaying as /Note/Create/?ApplicationID=1
I need it to display as:
/Application/1/Note/Create
View 1 Replies
Jul 9, 2010
If I have a controller with more than one action on, e.g. UserController, then I end up having that class require every dependency of every action. Is there a way I can have one controller per action and yet have the URLs appear the same way they currently do? e.g.MySite.com/User/Edit/1 would remap to User_EditController.Edit
View 1 Replies