mvc

Rails - Abstract/Shared Views

I have a few objects that are incredibly similar. In fact, they use STI and store all of the data in the same table in the DB. Currently, every time I add a feature or fix a bug, I have to update it in 3 different places, so I would like to DRY my code a little bit. The most common code duplication is in the views. I have seen people usi...

which of the following is better for eventhandling C#

WOW remind me never again to use 50+lines of java-like constructs when this can be done so easily in C# with implicit casting ...

Binding a simple sort dropdown to a list in MVC.

Hi guys, Im trying to bind a dropdownlist in ASP.NET MVC to a class. Luckily for me this will be a number between 1 and 10, however I'm not getting the output in my HTML that I would expect. I've set both the value and text properties which are populated ok in the View, but the selected value refuses to render. This is within the initia...

.net mvc ViewPage<T1> and ViewUserControl<T2> behaviour

I've got a viewpage with the inherits part looking like Inherits="System.Web.Mvc.ViewPage<User>" and a ViewUserControl with the inherits part looking like Inherits="System.Web.Mvc.ViewUserControl<Address> where User class (shortened) essentially looks like: class User { public virtual Address address { get; set; } } Now, if I t...

Where is ASP.NET MVC documentation?

The main page (asp.net/mvc) only seems to have a getting started guide and tutorial, plus videos, but I'm not able to find a proper documentation (classes, methods etc). Any link that can help me? Thanks ...

ASP.NET MVC, a plugin architecture and id collisions

So I have been waxing lyrical about a ASP.NET MVC to a friend who is about to start development of a new user interface.... He asked me if you could solve the following problem with ASP.NET MVC: Imagine a web app that supports plugins. In the current ASP.NET WebForms app the pluggin developer provides a usercontrol and some JQuery. The...

Trouble getting ASP.NET MVC app to redirect to error page for unauthorized users

I've got the following set up in the web.config of my ASP.NET MVC application: <authentication mode="Windows" /> <authorization> <allow roles="MySecurityGroup"/> <deny users="*"/> </authorization> <customErrors mode="On" defaultRedirect="Error.aspx"> <error statusCode="401" redirect="Help.aspx"/> </customErrors> Everything...

dismissing modalViewController moves main view buttons around iphone

So im using presentModalViewController and dismissModalViewController with animation set to "YES" in both cases. Which works fine. However, after the modal view is dismissed, all of the content on the main view has moved down what looks like 20px. Would anyone have ANY idea on what could be going on with that? ...

Getting user input from Model Layer

Have a problem following the MVP or MVC design pattern (applies to either one). I can't figure out how to cleanly prompt for user input from the model layer? Depending upon certain values in the model, I may need to prompt the user for input during the middle of a process. For example, we'll take a hypothetical PO entry process. Say ...

Model - View - Controler in Qt

I understand more or less how does MPV works. But I don't get what classes: QAbstractItemModel QAbstractItemView QAbstractItemDelegate / QItemDelegate Can do for me? If that is relevant, I'm using QGraphicsScene / QGraphicsView with some elements (visual representation of game board) that user can interact with while the interaction log...

Dynamic Controls in a Strongly Typed View (ASP.NET MVC)

Say i have the following: public class Person{ public int ID {get; set;} public string Name {get; set;} } public class Phone{ public int ID {get; set;} public string PhoneNumber {get; set;} } public Class AddEditViewModel{ public Person MyPerson{get; set;} public List MyPhones{get; set;} } I want to create a...

How to swap product image that is already in cart depending on selected product option?

Hi everyone, recently I was needed to enhance Magento (1.3.1) user interface. Particularly add a product image switcher (following http://inchoo.net/ecommerce/magento/create-a-color-switcher-in-magento/). The results: - image switcher works as expected, which is fine. The problem: - The product itself could hold as much as 15 or 20 col...

ASP.NET MVC and long running actions

I have a controller action that aggregates data from multiple sources: web service, database, file lookups, etc... and passes results to the view. So in order to render the page all tasks must have completed. Currently they are performed sequentially but as they are independent I am thinking of running them in parallel as this could impr...

ASP.NET MVC custom T4 templates for views

When I'm adding a new strongly-typed view to an ASP.NET MVC project, I can select between different view content templates (Create Details, Edit, List). I have read these are templates based on the Visual Studio T4 code generation engine. How can I author and configure my own templates and let them appear in the available templates when...

Using HTML radiobutton arrays in ASP.NET MVC

Hi, I tried to follow this but the default modelbinder let my array null on the server side. HTML: Question 1: <input name="list[0]" type="radio" value="1000" />No <input name="list[0]" type="radio" value="1001" />Yes Question 2: <input name="list[1]" type="radio" value="1002" />No ... Controller action: public ActionResult Anamne...

MVC Update Model

I'm unsure if this has been asked before but here goes. I have an MVC application with the HTML looking like this; <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<EnvironmentalVandals.Controllers.MonthlyItemsFormViewModel>" %> I have in the controller the following; [...

Creating the ASP.NET MVC Controller in Visual Studio 2008

I was running through the Movie Database MVC example on ASP.net. For some reason, when I right click the controller folder in Visual Studio solution explorer, I don't get the controller option from the add menu. I have Visual Studio 2008 SP1 and using .net 3.5. Any ideas why the controller option is missing? ...

LINQ to SQL and Data Projection, MVC

HI I have a table with some some values (IDs), and of course when i get the result i got just the int IDs, but i want to put it more user friendly, for example when its the number 1, i want to put the string "Avaible", when its 2 "Not avaible", im on an N tiers enviroment and i need to get this done on the Model, whats the best way to a...

Java: Form Submission in MVC : What is the best practice?

I am using a MVC framework which is a bit like struts. So, say I have a "Edit Store" link in my application this is how the url would look like: http://localhost:9080/test?action=editStore&amp;storeNum=10 Now, action determines my Action (analogous to Struts Action) to be run. The corresponding action here is: EditStoreAction. Clicking...

There is no ViewData item with the key 'taskTypes' of type IEnumerable<SelectListItem>

I'm getting the error message above when adding an onchange attribute to a Html.DropDownList in ASP.NET MVC: <td><%= Html.DropDownList("taskTypes", (IEnumerable<SelectListItem>)ViewData["TaskTypes"], "None", new { onchange = "document.getElementById('NewTask').submit()" })%></td> When the view initially loads, I do not get the error. ...