asp.net-mvc

Asp.net MVC Binding

If for example you have a Car class and that Car class contains a car type which is reflected by a table in the database. How do I get MVC to bind to car type when I create a new car? public class Car { public string Name { get; set; } public CarType Type { get; set; } } public class CarType { public int CarTypeId { get; ...

ASP.NET MVC: DropDownList -- Of DataSource, SelectedItem, and inline code access within the View

As far as I can tell, there are 3 ways to create a DropDownList in an ASP.NET MVC View: Hand code the HTML manually <asp:DropDownList ID="someID" runat="server"></asp:DropDownList> <%= Html.DropDownList("someID") %> I think we can all agree that #1 is (generally) a waste of time. With #2, it appears to be the "WebForms" way of doing...

Deploy ASP.NET website alongside ASP.NET MVC website

I am working on an upgrade for a company website. It currently in production using vanilla ASP.NET. For the upgrade I switched the framework to ASP.NET MVC. I am ready to deploy a beta version of the website. I have tested it locally by creating another website in IIS and just copying the published files there; that works. I only have a...

Email errors in a asp.net mvc application

Is there a single place where I can track any uncaught exceptions in a asp.net mvc application? I want to email the error, or write to a file/db. ...

Why does OutputCache attribute require the VaryByParam parameter to be set?

I've done zero research on this, I'm just curious. The OutputCacheAttribute class in ASP.NET MVC requires a value for Duration and VaryByParam. I get why Duration is required, but not VaryByParam. ...

Looking for a great Ajax enabled datagrid that will work with .net MVC

I am researching writing a website in Asp.Net MVC 2, it will rely heavily on a datagrid control for showing data and editing data. Ideally it would support AJAX so the page doesn't have to reload with every update. Rather than writing this from scratch, does anybody know of a really great, well supported 3rd party control for doing this...

Is ASP.NET MVC a real MVC-Pattern?

For the last couple of Days I have been working on a small web application. I decided to use ASP.NET MVC. I made this decision mostly because I think it is the best way to really control the web front-end and render valid HTML pages. However, I know that MVC can be much more. Even though my App is quite small, I am focusing on my app...

Project template missing in Visual Studio 2010

Today in one of the computer i installed visual studio 2010 professional edition, and successfully installed. But in my new project template "Asp.net MVC 2 website" is missing. Also I'm not able to open an already created MVC 2 project also. I'm also having MVC 2 installed with VS 2008 Sp1 in the same machine and is working fine. I unins...

ASP.NET MVC: First access after some minutes slow, then every following request is fast

Hello, when I access any page of my ASP.NET MVC website first time, then this first request is slow. It needs about 4-5 seconds to load. But every following request to any page is fast. When I wait some minutes or a hour then every first request is slow again. Every following request is fast. I think that IIS 7 is compiling the code a...

Weird error in strongly-typed MVC2 view

The ViewUserControl below results in the following error at runtime: The Collection template was used with an object of type 'System.Data.Entity.DynamicProxies.Collection_1D9779ACB92AE24E3428C288EA7B1480A6477CF8861FB7582692E775613EFB3A', which does not implement System.IEnumerable. The error occures on this line: <%: Html.EditorFor(mode...

What is the correct way of Unit testing ViewEngines.Engines.FindView?

I recently did some refactoring of my mvc application and realized that there are alot of static views returned. Instead of having multiple controllers with action results that only return a view I decided to create one controller that returns the static views if they exists and throws a 404 error if the view doesn't exist. public Actio...

TempDataExtensions from the winter of 2007---still needed in MVC2?

This extremely cool article written in the winter of 2007 shows me this code: public static class TempDataExtensions { public static void PopulateFrom(this TempDataDictionary tempData, object o) { foreach (PropertyValue property in o.GetProperties()) { tempData[property.Name] = property.Value; } } public stati...

Razor view engine - exception when calling Any Function

Hello, I am trying to convert an existing ASPX page to cshtml format. The original ASPX looks something like this: <% if (!Model.ObjectList.Any()) { %> <tr> <td>No data found</td> </tr> <% } The equivalent Razor version looks like this: @if (!Model.ObjectList.Any()) { <tr> <td>...

How to get all input controls which are of type file in jquery

I want to get all the file upload controls on my page, Im adding multiple file upload control so i dont have any idea how many they can be but i have to get all of them in jquery. Im using asp.net mvc and jquery ...

Generate Database / Entity Data Model from C# Classes

I have been using Subsonic with MVC.NET and love the feature that allows me to generate a database from the c# classes. This is great because it allows you to think about the app first and the data second. Now that I am moving onto MVC.NET 2.0 - I am using the features in the Entity Framework which are great giving form validation clien...

Why does intellisense quit working

I'm working in an ASPX page where intellisense is not functioning. The page compiles and functions correctly - but if I intentionally create a syntax error, instead of placing the message in-line it's being displayed in the top line - the <%@ Page Title="Stuff" Language="C#"...%> In the same project, but a different page, everything wor...

how i can write css for individual page of my project who developed in MVC 3

i thing i put something wrong here sorry for that if you confused. i want to put Javascript or Css in the Head of my page [who is render in browser]. when i try to put them then i found that he inside of Body not inside of head tag. i know that i can easily put in head if i not inherit them from master page. but how i can put on my ...

What is the release date for ASP.NET MVC 3?

Looking at the preview 1 and it looks great ...

ASP.NET MVC NerdDinner Partial View Question

This is probably another dumb question.... I'm new to ASP.NET MVC and I'm following The NerdDinner tutorial online. I've reached the section regarding partial views which shows how to reuse a ascx form to create or edit a row for the database. The ascx form has a submit button: <p> <input type="submit" value="Create" />...

Asp.net WebForms app that runs MVC in a subfolder

Let's say I have an Asp.net WebForms application that has: few *.aspx files in root folder that run as WebForms application (no routing involved) a subfolder ie FormsFolder that has other files and subfolders in it that run as a regular web forms application a subfolder MvcFolder that has a normal structure of an Asp.net MVC applicatio...