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; ...
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...
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...
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.
...
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.
...
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...
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...
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...
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...
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...
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...
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...
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>...
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
...
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...
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...
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 ...
Looking at the preview 1 and it looks great
...
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" />...
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...