mvc

Understanding the MVC Pattern

I am having some trouble understanding the MVC Pattern. I do understand we are trying to decouple the GUI from the business logic, although I'm having problems understanding how. From what I understood, the View, is what the user sees. So it generally is the window/form. The Controller is inbetween the View and the Model. The Controller...

Anyone got a Date of Birth Validation Attribute for C# MVC?

Someone must have written this before :-) I need a validation attribute for date of birth that checks if the date is within a specific range - i.e. the user hasn't inputted a date that hasn't yet happened or is 150 years in the past. Thanks for any pointers! ...

Using regular expressions in .NET MVC route to handle upper-case characters

I am working on a .NET MVC application and am trying to write a route in global.asax.cs. The goal is, I want any URL that contains an uppercase character to run through said route. The idea is, the router will lowercase the URL and redirect it. My approach is to use a regular expression to handle this. Here's what I have: routes.Map...

ASP.NET WebForms with MVC localization issue

I have a mixed project: WebForms with ASP.NET MVC2 and is running OK. I have done this tutorial on separate MVC Project and localization is working fine. However, when I want to apply localization (mentioned above) in my mixed project, it seems to be ignored. It doesn't matter what I set in global.asax file (de-DE, fr-FR, pl-PL) always ...

Need To Access ViewData on MasterPage... or other options

I am using MVC2 in VS2010 with .Net 4.0. I have a situation in which I will have a bunch of partial views that I need to all have the same template. Basically I need them all wrapped with the same DIV (and other junk). I just want one place to change this DIV... so I used a master page. It works great, all the partial views use that ...

Automapper: How do you map a type that is conditional?

Greeting Gurus, So basically I have this a Map that I setup for use for TripFeeSchedule, trip fee schedule is a IEnumerable type. I am trying to map this so I dont have to have 5 or so ValueResolvers, and I am stuck. What i basically want to do is map a type of OPtional fee from a single fee schedule. So for example if the type is a la...

Filling GridView on some Button Click in MVC

Hi, I am working on some project which is in classic ASP.NET, but I need to migarate that into MVC Right Now I am having a page with one button and gridview which get fill on clicking the button. Gridview has the functionality like EDIT, DELETE, Paging, OnRowCommand Event. How should I perform this page through MVC. I know gridview c...

What is the best way to solve this problem in a model?

I come across this a lot, and have always been curious if there is better way. Consider this (example only, assume an OO query builder) class Dogs extends Pets { public function getAll() { return $this->parseRows($this->db->get('dogs')); } public function getBig() { return $this->parseRows($this->db->get('...

GRASP's Controllers and MVC's Controllers question

Introduction to the problem I have been taught about OO Analysis and Design through Craig Larman's Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, that follows the UP(Unified Process). When using it, we usually draw a Domain Model and from it, doing Interaction/Association Di...

Javascript onclick _dopostback in MVC not posting back

Hi I'm using ASP.NET MVC to try to postback after confirmation using javascript, this is the button: <input type="submit" id ="RemoveStatus" value="Remove Status" name="button" onclick="return CheckRemove();"/> This is my javascript in my CheckRemove() js function: var button1 = document.getElementById("RemoveStatus"); if (conf...

asp.net mvc alpahetical naviagation populating record problem

i want to implement the alphabetical navigation like A B C D and so on ,when the user press any alphabet ,it will populate the table with the record based on the alphabet.Can someone help to correctly implement that . here is my start. Basically i am having problem in populating the records. on clicking the alphabet it doesn't do anythin...

Allow users to download PDFs in PHP5, ZEND, MVC environment

All, I have a PHP5 application written with Zend Framework and MVC style. My application allows multiple users to login and see content based on their privileges. I have a dropdown on the home page. Upon selecting the dropdown, an ajax call occurs which populates the page with a table. Also, it generates a PDF file with the table data u...

Create a link to a local file, but open the browsed folder not the actual file

Hello, I am trying to export a List of items from a web page to the local machine. Upon successfully exporting the list (which it is successful, since the file is there and file.PathExists returns true), I want a link to pop up to the file. Now I want this link to actually open a system browsing window to the location of the file, I do ...

Get referring view in an Action - MVC2

This may be more of a best practice question. I have three views (create/details/edit) that all link to their own results view (createResults/detailsResults/editResults). Each results view shares a partial with a results table on it. When a user submits one of the three (c/d/e) views, should each results view have its own action, even...

What's a good way to handle post data in Codeigniter?

I.e. would you recommend me to use one controller method like this: function save() { if(!is_bool($this->input->post('')) { $post_data = $this->input->post(''); $this->mymodel->save($post_data); } $this->load->view('myview'); } Or would you recommend writing it using two methods? function save() { ...

Visual Studio: How to override the default "Build Action" for certain extension types per project or solution?

I'm serving my asp.net mvc views from many assemblies and copying views to the main application on post-build event. This works, however, I realized, that when I change something in view and just hit F5, changes are not included. What I have to do to see changes is to: save, build<- explicitly clicking, and then hit F5. However, it's pr...

Download pdf file from a string using Jquery

All, I have a PHP5 application written with Zend Framework and MVC. On my home page, I want to incorporate the functionality to download a dynamically generated pdf file. The way this is done is: User clicks "download file" link. On Click, an AJAX call occurs to a PHP controller, which takes the form data, generates the pdf and return...

How to remove headers in an array

All, I have a PHP application that seems to generate the following headers in an array. I wish to remove these headers, so I can set new ones like the one for a pdf download. array(2) { [0]=> string(23) "X-Powered-By: PHP/5.3.1" [1]=> string(23) "Content-type: text/html" } How do I do this, as this doesn't seem to work: var_...

Can a model house multiple functions querying different domains?

I have a domain for users that connects to my user table, which includes information like username, first name, and last name. Then I have a domain for emails, that connects to the email table because a user can have more than one email. The email table consists of a fk to connect the user with their emails, and other fields like addres...

System.Web.MVC.dll still references Beta version

I'm running a build of my solution from a different computer (build machine), and found out that that system is still referencing the Beta version of System.Web.MVC.dll. How can I get it to reference the 1.0 version of the dll? ...