mvc

Will the Entity Framework 4 work with MVC 2 - since MVC is based on 3.5?

Can I use the upcoming Entity Framework 4 with aspnet mvc 2 since mvc is based on 3.5? ...

In MVC app using JQGrid - how to set user data in the controller action

How do you set the userdata in the controller action. The way I'm doing it is breaking my grid. I'm trying a simple test with no luck. Here's my code which does not work. Thanks. var dataJson = new { total = page = 1, records = 10000, userdata = "{test1:thefield}", ...

Best way to model these relationships in Rails

I'm looking to create a Rails application with three models. One model represents cars, another represents the colors cars can be painted, and a third represents an order for a car in some color. What's the best way to structure the relationship between these models? ...

ASP.NET MVC - putting controller & associated views in the same folder?

We are currently using the default folder structure for our MVC app, and were wondering if it is possible to instead put a Controller and its related views into the same folder. For example, a subset of our current structure is: Model folder OrderViewModel.cs Views folder OrderView.aspx OrderGrid.ascx OrderHeader.ascx ...

Kohana beginner question: controllers, hooks and vars - Oh my!

I'm new to the MVC concept, and somewhat new to PHP. Question 1 Before every controller is loaded, I’d like to run a function which checks to see if a database-table exists. Is the proper way to do that with hooks? Question 2 Before every controller is loaded, I’d like to set a few variables which are determined by a call to the db. ...

Kohana constructor purpose

As far as Kohana is concerned, can you give me a short sentence or two as to WHEN and WHY I need to use a constructor within my controller? After a LOT of reading, I can't seem to wrap my tiny little brain around the constructor concept. Looking for "layman's terms" here. =) Edit: Question pertains to Kohana v2.3.4 ...

Recommendations on handling object status fields in rails apps: store versus calculate?

I have a rails app that tracks membership cardholders, and needs to report on a cardholder's status. The status is defined - by business rule - as being either "in good standing," "in arrears," or "canceled," depending on whether the cardholder's most recent invoice has been paid. Invoices are sent 30 days in advance, so a customer who...

Change Main in WPF project

Always annoyed me how C# wants to do the startup for you. So now I am trying to make my own main method. It's not working: I have provided this main method: [System.STAThreadAttribute()] [System.Diagnostics.DebuggerNonUserCodeAttribute()] public static void Main() { Model model= new Model(); Controller controller = new Controll...

Need to escape the quotes of a variable in MVC View to pass as a parameter to Javascript

Hi all, I have a MVC view in which I have to pass a string variable to javascript, but that string variable has single quotes in it ('). I am trying to do something like this <a onclick="JavaScript:AddressHandler.ProcessAddress('<%= homeAddress %>');" class="button-link">change</a> homeAddress has single ...

Confusion between view logic and domain logic in a ASP.NET MVC Web Application.

I am getting confused between domain/application logic and User Interface logic. To illustrate what I am trying to nail down, I will describe an imaginary program below for illustration purposes: (1) Imagine a small application with a set of 3 cascading drop-downs. As you select one dropdown it triggers a jQuery Ajax GET which ends u...

Is there a better, less cumbersome way to extract text inline than <%= %>?

Let's say I am working in a .aspx page (or View, for the MVC folk) and I have a block of inline code: <p>Some HTML and content</p> <% foreach (var x in foo) { %> <%= x.myProperty %> <% } %> <p>Moar HTMLz</p> Is there a more efficient, less cumbersome way to extract text into the markup than this model? It seems like there are a l...

xVal Client side Validation with validation Callout

Im using MVC data annotation with xVal Client Validation on a form. How do I implement something like the a asp.net validation callout extender instead of display red error messages. ...

Improving MVC usage

I'm busy building an MVC application in PHP using Kohana MVC framework, and it works very well. But there are some small annoyances which I'd like to address. A lot of logic is repeated across actions in controllers and controllers themselves. I've been thinking about it, and I thought it would be smart to define an object which contain...

ASP.NET MVC JQuery - flexible alghoritm for calling asp.net mvc methods

Greetings, i would like to prepare some good "machine" for calling asp.net mvc methods from jquery. The concept is as follows: The concept is to have a one method each requests will be calling. By using visitor pattern I will be able to determine what kind of operation i should do. public interface IRequestVisitor { void VisitReq...

Use of XML for Model class and structuring

Hi there, I am currently working on a little application: The structure follows in some way the MVC pattern. For short it has the basic things, Models, Controllers etc. Now I am sitting here and do not know whether : 1. The SQL database is only managed by a model through methods the programmer gives him like: "Hey we have name reco...

different ActionInvoker based on actions assigned in global.asax

how would i go about finding out what action was defined for this function protected override void ProcessRequest(HttpContextBase httpContext) { IController Controller = new CatalogController(); (Controller as Controller).ActionInvoker = new MyActionInvoker(); Controller.Execute(RequestContext); } a...

What's the ideal method for redirecting to a new url from inside of a View?

So inside my ASP.NET MVC View I have a conditional statement to redirect users to a different page. What is the best way to do this? What is the Controller.RedirectToAction() equivalent for a View? ...

C# MVC ViewModel Property OrderBy Exception

I have a collection of ViewModel objects that I am attempting to sort. This is an abbreviated view of my ViewModel class: public class BookIndexFormViewModel { //Properties public Book Book { get; set; } //Constructor public BookIndexFormViewModel(Book book) { Book = book; } Thi...

validation problem with MVC 1

Edit.aspx: <th>Calendar<input id="datepicker" name="datepicker" type="text" class="input-box"/></th> Controller action: // POST: /Studenti/Edit/5 [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(int[] rb, int id, string datepicker) { List<nastava_prisustvo> nastava = new List<nastava_prisustvo>(); ...

Doing MVC or not doing it?

I'm new to MVC structure and feel it's harder to get things done because it's a new way of doing things. Are there anybody who has experience of MVC vs. pages way of doing things. Is the MVC way of doing it the holy graal now or is there still value doing ordinary object-oriented development (or even procedural pages webdev)? Is MVC a fa...