asp.net-mvc-2

ASP.NET MVC 2 VB, Not recognising my Import Namespace.

I had a problem with a project I converted from C# to VB, in that the VB version it cannot seem to find an object even though I declared it with an Import statement at the top. I created a new, default MVC 2 VB project, and the same problem occurs there. I create a new MVC 2 application, I then add a reference to System.Data.Services.C...

Where to find documentation/tutorials on ASP.NET MVC2?

Hello, It looks like the final release for ASP.NET MVC 2 has been already around for 2 weeks. Unfortunately, I can't find documentation that's intended for MVC 2 exclusively. I've checked Amazon.com (no book yet on MVC2), ScottGu's Blog (only 2 short posts), ASP.NET/MVC website (they've only posted what are alreadi in the ScottGu's blog...

is there a difference between HttpPost AcceptPost and PostOnly attributes from mvc2 and mvccontrib

is there a difference between HttpPost from mvc2 and AcceptPost, PostOnly attributes from mvccontrib ? ...

Custom Editors for custom typed properties for a Model in MVC2

I am working with some business objects that relate to one another through their properties. For instance I am loading an "Entry" object from the data store and relating it to "User" objects through the Author and Editor properties. class Entry{ public User Author { get; set; } public User Editor { get; set; } } class User{ ...

ASP.MVC 2 RTM + ModelState Error at Id property

I have this classes: public class GroupMetadata { [HiddenInput(DisplayValue = false)] public int Id { get; set; } [Required] public string Name { get; set; } } [MetadataType(typeof(GrupoMetadata))] public partial class Group { public virtual int Id { get; set; } public virtual string Name { get; set; } } And ...

Wondering why DisplayName attribute is ignored in LabelFor on an overridden property

Hi, today I got confused when doing a couple of <%=Html.LabelFor(m=>m.MyProperty)%> in ASP.NET MVC 2 and using the [DisplayName("Show this instead of MyProperty")] attribute from System.ComponentModel. As it turned out, when I put the attribute on an overridden property, LabelFor didn't seem to notice it. However, the [Required] attribu...

Validation firing in ASP.NET MVC

I am lost on this MVC project I am working on. I also read Brad Wilsons article. http://bradwilson.typepad.com/blog/2010/01/input-validation-vs-model-validation-in-aspnet-mvc.html I have this: public class Employee { [Required] public int ID { get; set; } [Required] public string FirstName { get; set; } [Required] ...

Modelbinding Failing VS2010 asp.net mvc2

The contactAddModel.Search always comes through as null - any ideas? View declaration <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<rs30UserWeb.Models.StatusIndexModel>" %> ViewModels public class StatusIndexModel { public ContactAddModel contactAddModel; public...

StringTemplate view engine and Areas

Hello I have a problem combining StringTemplate view engine and Areas, i don't know what to do so paths can be recognized. Anyone tried that combination? ...

When developing a MVC project, is the the toolbox really useful?

I'm a noobie when it comes to VS, specifically VS 2010. I'm trying to learn MVC 2.0. If you're developing a pure MVC project, it seems like most of the toolbox is not useful. Shouldn't the IDE hide controls that aren't useful? Specifically, I'm looking at the AJAX extensions like Timer and UpdatePanel, but it seems like a lot control...

Is there an "extended" UIHint attribute to apply CSS styles for DisplayFor - EditorFor templates?

Intro: After reading Brad Wilson Metadata series and searching unsuccesfully on google, I was wondering: Question: Has any OS project / code been created that allows you to tag CSS styles in the Meta information, for example in my (buddy) Model, I want to be able to decorate a property with multiple CSS styles (a single style you can fa...

MVC 2 with VS 2010 View Building Error: Feature 'anonymous types' cannot be used because it is not part of the ISO-2 C# language specification

I have a shared project where I store all of my custom EditTemplates and DisplayTemplates. This is a regular C# class library project with the views all tagged as embedded resources. The target framework of this project is ".Net Framework 4". Inside the /Views/ folder I have included this web.config file so I get MVC 2 intellisense whe...

Need help using the DefaultModelBinder for a nested model.

There are a few related questions, but I can't find an answer that works. Assuming I have the following models: public class EditorViewModel { public Account Account {get;set;} public string SomeSimpleStuff {get;set;} } public class Account { public string AccountName {get;set;} public int MorePrimitivesFollow {get;set;} } a...

This 404 seems unavoidable - what am I doing wrong? [Ninject 2.0 with ASP.NET MVC 2 on .NET 4]

I downloaded the fairly new Ninject 2.0 and Ninject.Web.Mvc (targeting mvc2) sources today, and successfully built them against .NET 4 (release configuration). When trying to run an application using Ninject 2.0, i keep getting 404 errors and I can't figure out why. This is my global.asax.cs (slightly shortified, for brevity): using .....

ASP.net MVC 2 EditorFor Dictionary Bind

Hi! I try this, but don't work. bemutatkozas@Modify = null all the time. public class Iroda { public Dictionary<int,string> bemutatkozas { get; set; } } public ActionResult Index() { var dct = new Dictionary<int, string>(); dct.Add(1, "magyar"); dct.Add(2, "angol"); dct.Add(3, "olasz"); re...

jQuery: modify hidden form field value before submit

I have the following code in a partial view (using Spark): <span id="selectCount">0</span> video(s) selected. <for each="var video in Model"> <div style="padding: 3px; margin:2px" class="video_choice" id="${video.YouTubeID}"> <span id="video_name">${video.Name}</span><br/> <for each="var thumb in video.Thumbnails"> ...

Using Repository and Unit of Work patterns with Entity Framework 4.0 and MVC 2

Hi, I'm following this article Using Repository and Unit of Work patterns with Entity Framework 4.0. I'm tying to implement the Repository and Unit of work pattern, using Asp.Net MVC 2 and Entity Framework 4. Please let me know if I'm doing it right... In the Models folder: Northwind.edmx Products.cs (POCO class) ProductRepository....

Correct way to edit and update complex viewmodel objects using asp.net-mvc2 and entity framework

I have a table in my database with a one to many relationship to another table, which has a relationship to a third table: ParentObject ID Name Description ChildObject ID Name Description ParentObjectID AnotherObjectID AnotherObject ID Name The objects are mapped into Entity Framework and exposed through a data access cl...

How to post back selected checkboxes to Controller

I have following view <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>Tables <%=ViewData["RetriverName"] %></h2> <%using (Html.BeginForm("ResfreshSelectedTables", "Home")) { // begin form%> <table id="MyTable"> <thread> <tr> <th style="width: 150px; text-align:center"><in...

Html.DropDownListFor<> and complex object in ASP.NET MVC2

Hi, I am looking at ASP.NET MVC2 and trying to post a complex object using the new EditorFor syntax. I have a FraudDto object that has a FraudCategory child object and I want to set this object from the values that are posted from the form. Posting a simple object is not a problem but I am struggling with how to handle complex objects...