mvc

ASP.NET MVC ViewUserControl: How do I load its scripts dinamically?

I have a ViewUserControl that will be used in some pages in my site, but not all. This ViewUserControl requires a javascript file, so I would like to have the script reference added automatically to the head session of the pages that are using this ViewUserControl, is that possible? I tried to add a content control to it, but looks like ...

ASP.NET MVC Utilize Test Controller or Test Model

In a new MVC application, I am building out all of the models, controllers, views etc. without my backend DB setup yet. I have an idea of what the backed will look like, but for now I'm focusing on the application. I know that I can mock up a dummy model within the controller like: public ActionResult Pictures() { MyMVCApp.Models....

What is a good balance in an MVC model to have efficient data access?

I am working on a few PHP projects that use MVC frameworks, and while they all have different ways of retrieving objects from the database, it always seems that nothing beats writing your SQL queries by hand as far as speed and cutting down on the number of queries. For example, one of my web projects (written by a junior developer) exe...

Subfolders in controllers and views

Hi, I wanted to have more than one controller and view for same object/model in asp.net mvc, but it turned out to be a little complicated than I expected. Basically what I want to do is something like this : site.com/product -> will show product details to visitors. site.com/admin/product -> will show some extra informatio...

Is The Web's version of MVC different than traditional MVC?

I've done a fair amount of work on MVC on the web, and we're learning about it in my OOP class. I'm seeing some differences, and I can't tell whether that's because the Web's version of the MVC pattern is different than the traditional one, or whether I misunderstood it. From my understanding, The model (your flat files, RDBMS', etc) is...

Should I iterate through business objects from Views in a MVC application?

I'm wondering how many data access should I do in a View when using a MVC framework. For instance: In my application there is a page that shows a list of all my favorite artists and, for each artist, a list of all songs of that artist. The question is: Should I pass only the artist list to the View, or should I pass also all the data (a...

Why does ASP.NET MVC path appear with variables?

In my MVC app, why does Return RedirectToAction("Edit", "Forms", New With {.member = "123"}) return http://localhost:13/Forms/Edit?member=123 insted of http://localhost:13/Forms/Edit/123 ? And why does <%=Html.ActionLink("MyLink", "Edit", "Forms", New With {.member = "123"}, Nothing)%> do the same thing? ...

ASP.net MVC RTM - "project type is not supported"

After installing ASP.net MVC, when I attempt to load a existing or a new MVC application (straight from New Project - A project for creating an application using the ASP.NET MVC framework (1.0) (.NET Framework 3.5)) I get the following error: Microsoft Visual Studio The project file 'path' cannot be opened. The project type is not ...

MVC - How to develop a wizard like control functionality in ajax.

Hi, I thought I would ask here about how to develop a wiazrd like control in ajax for MVC before I started it. The control will have pages that have data entry controls and on each page submission insert data into a database. Any ideas how to go about this? Malcolm ...

ASP.NET MVC Default Parameters

I have created a new route like the following: routes.MapRoute( "BlogYMD", "blog/date/{year}/{month}/{day}", new { controller = "Blog", action = "Date", year = "2009", month="01", day="01" }); The view simply returns a concatenation of year, month and day. This works fine for URL's like: http://localhost/blog/date/2...

Can I have additional fields on the users table in CakePHP & still use the built-in auth methods?

I'm using cakePHP and I want to add a First and Last name column to the Users table, but when I pass through the field values firstname & lastname the columns are always left null, while the default fields are populate fine. Is it possible to do this or do I need to have a second table to store these values? Update code: Registration ...

passing variables in a mvc pattern

Hello, I have built a system that conforms to the mvc pattern in PHP. The controllers and actions are part of the urls in my application. So I have: www.example.com/controller/action/ So now I am looking for a way to pass on variables. For forms I just use the post method, but sometimes I would just like to link to a different page an...

Where do I save partial (views) in Zend Framework, to be accessible for all Views in my App?

I have several view Partials (like paginator partial) which I want them to be available To all view scripts in my application. Is there a directory I can put partial vies in, and they will be available to all? Or, how do I define such a directory? ...

Handle checkboxes with strongly typed views in Asp.net MVC

What is the Correct(TM) way to handle checkboxes with asp.net MVC and strongly typed views. I have a class 'Bar' that has a member 'foo'. 'foo' is type 'byte'. Now what I would like do, is have something like this in controller: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Page( Bar bar ) { if (ModelState.IsValid) { ...

In MVC, what are the limitations on the Controller?

Should the Controller make direct assignments on the Model objects, or just tell the Model what needs to be done? ...

MVC - Using Ajax to render partial view

Hi, I have this markup in an MVC app. <div id="ingredientlistdiv"> <% Recipe recipe = (Recipe)Model; %> <% Html.RenderPartial("IngredientsListControl", recipe.Ingredients); %> </div> <div id="ingrediententrydiv" align="left"> <% using (Ajax.BeginForm("Add Ingredient", "Recipes/UpdateStep2", new AjaxOptions { UpdateTargetId...

How much code in a rails view is ok?

I know that it is best to keep code out of the presentation layer. But, I am wondering how much is considered "acceptable". For example I populate an html select box with this line of code. CodesecureProject.find(:all,:order => 'name').collect {|project| [project.name, project.id] } Right now I have this line of code embedded in th...

Simple Web Server and MVC framework for Java

Does anyone know of a simple Web MVC framework and Web Server for Java that is open source? This is intended as a simple web server and framework for students in a tutorial class. It's important these both the web server and MVC framework are simple, OSS so students can easily peer under the hood and the tutors can easily support it, l...

C# asp.net mvc 1.0 routing

In my web app. i want to setup a route like this: /document/quality/index /document/general/index /document/quality/detail/[id] /document/general/detail/[id] As you can see i have two kind of documents: general and quality. What is the best way to set this up in my global.asax file? I tried the following, but i don't get it work: ro...

ASP MVC Redirect without changing URL(routing)

Hello there, im having a little problem accomplishing this, hopefully someone can help me out. Currently using c#. Goal: I want to be able to type URL: www.mysite.com/NewYork OR www.mysite.com/name-of-business Depending on the string I want to route to different actions without changing the URL. So far i have: In: public static void...