If I need two modes in my application what design pattern would I use so I can prevent ugly conditional code? App is currently MVC, but I don't want conditional code in my controllers and don't want two controllers for each view unless I have to.
Any suggestions?
...
how i return a value from javascript function to a c# variable (in controller)
and also i have a multicolum dropdown box in a form , eg book details , when the user makes the selection the book name is set in the dropdown , but when submit is hit i want the code book to be returned(this value is returned by my javascript) for billing p...
How can I mock a DataServiceQuery for unit testing purpose?
Long Details follow:
Imagine an ASP.NET MVC application, where the controller talks to an ADO.NET DataService that encapsulates the storage of our models (for example sake we'll be reading a list of Customers). With a reference to the service, we get a generated class inheritin...
How do people generally handle conditional statements in MVC frameworks
For some of my pages (made under Kohana) I want the user to have more options depending on whether they are logged in or not, and whether the profile is their own profile for example. From your own experience, do you create separate views, empty variables, do the l...
I am designing a web application that requires loading multiple components on a single page. (In terms of page layout is similar to Google reader) I like to keep these components separate from each other (for reasons such as reusability). For example, I have a left panel that let's user navigate among multiple feeds that he's subscribed...
I'm using an ActionFilterAttribute to do custom authentication logic. The Attribute will only be used on a derived Controller class that contains my authentication logic.
Here's my Controller, derived from my custom controller class, and a sample attribute:
public class MyController : CustomControllerBase
{
[CustomAuthorize(UserTy...
I have a website where I allow users to create new Part records. I'm trying to figure out the best way to validate specific fields for uniqueness. I want to make sure that somebody doesn't try to add a Part with PartNumber 1234 if that PartNumber already exists on a different Part.
The Web Application is using Asp.net MVC with fluen...
If a user is logged in and the ChangePasswordRequired flag is set, i need to disregard the current action and redirect them to the ChangePassword action.
In other words, I do not want the user to be able to do anything until he or she changes his or her password.
Which method should my base controller override and how should I handle t...
Can someone please explain these functions:
RequestHandlerComponent::renderAs()
RequestHandlerComponent::respondAs()
RequestHandlerComponent::setContent()
It feels slightly redundant to have all three of them (as public methods anyway). If I want to respond to a request with a PDF file, does that mean I'd have to call all three fun...
I am attempting to use MVP in WinForms and am confused on how to best handle coordination among child views.
For example, I have a parent view that has two child views. Events on one child view need to cause an action to be taken by the second child view.
Should the parent view control this directly? It seems like I am bypassing the M...
I'm trying find a way to do something with MVC that I was able to do with WebForms.
I have a set of steps a user needs to go through to fill in data. In a previous case it was registering animals on an 'classifieds' site that was designed in webforms. For simplicity lets say it has 3 pages. Page 1 asks them what type of animal in a drop...
Please help me in coding for controller and support for URL Routing for PHP MVC framework.
...
HI All,
I want to create a web site in MVC architecture, with out using any frameworks.
What would be the Files/Folder structure (Module/Views/Models).
EDIT: I know the Zend, CakePHP. but my Question is how can we structure in Simple PHP.
I dont want to use any of the frameworks, because i need the maximum performance/speed.
I heard t...
is it possible to pass derived types where base types are expected to strongly typed views?
I.e
Products/List
News/List
where "list" view Inherits System.Web.Mvc.ViewPage<Model<BaseList>>
controller renders view i.e View("List", ProductsList)
edited
return View("List", new Model<ProductsList>());
Model<T> where T : IMyList
Pr...
I am trying to implement a application which i need to follow mvc framework. But I need to gather some ideas in that. Please give me some suggestions and references which includes some sample codes in PHP with URL routing.
...
Consider this scenario:
class Book
{
int id;
List<Category> categories;
}
class Category
{
int id;
string name;
}
I have a strongly typed view for the class Book. When the librarian wants to edit the details of any Book, I want to display checkboxes with all possible categories. In case Book.categories contains a cate...
Is there a cleaner way to do this in a JSP/Struts1 setup ?
<% if (SessionConfig.isAdminMode() ) { %>
... some HTML here ...
<% } %>
EDIT: In admin mode I would like to have access to additional parameters from a form element,
e.g. from the form element:
input type="text" value="Test user" name="Owner"
EDIT 2: Actually, my probl...
I am building an intranet site that will display different lists based on the computer name because different computers are in different areas, is there a way (within a controller or model) to determine the client's computer name?
I have tried system.environment.machinename but that only returns the name of the server, any other ideas?
...
My first route:
// Should work for /Admin, /Admin/Index, /Admin/listArticles
routes.MapRoute(
"Admin", // Route name
"Admin/{action}", // URL with parameters
new { controller = "Admin", action = "Index" } // Parameter defaults
);
is not re...
I have a number of applications written in different languages (Java, JavaScript, PHP, etc.). Their view/presentation layers display things in various formats: HTML, plain text, etc.
I want to display some textual/numeric data in roughly the same way in each application. Of course, the result would be slightly different depending on the...