asp.net-mvc-2

How can I use Html.DisplayFor inside of an iterator?

I am loving MVC 2. The whole thing just fits the web so well. There is one piece of functionality, however, that I am unable to coax out of the Html.DisplayFor() function: <@ Page Inherits="ViewPage<IEnumerable<Foo>>"> <% foreach(var item in Model) { %> <%: Html.DisplayFor(item.BarBaz) %> <% } %> I need to be able to use the ...

ASP.NET MVC 2 - AntiXSS vs Built In MVC Encoding

Now that MVC has introduced HTML Encoding via <%: blah %> is there still value in using <%= AntiXSS.HTMLEncode(blah) %> instead? For Example: My application will take all content in (including JavaScript) and store it in it's raw state in the database. I was planning on simply outputting everything using something like <%: m...

Python vs C#/.NET -- what are the key differences to consider for using one to develop a large web application?

My organization currently delivers a web application primarily based on a SQL Server 2005/2008 back end, a framework of Java models/controllers, and ColdFusion-based views. We have decided to transition to a newer framework and after internal explorations and mini projects have narrowed the choice down to between Python and C#/.NET. Le...

MVC strongly typed View access to GetEnumerator()

I am very new to MVC and am looking for the best way to handle access to the Enumerator of the following class when used as the type of a View: public class TemplateCollection : IEnumerable<Template> { private IEnumerable<Template> templates; public TemplateCollection() { LoadTemplates(); ...

How to get VS 2008's Add New Project dialog to show me the MVC 2 project templates?

How do I get VS 2008 Professional Edition's Add New Project dialog box to show me the ASP.NET MVC 2 project type? It currently shows me only the MVC 1 project template (ASP.NET MVC Web Application). I have both versions of MVC installed. ...

Getting a EmailMessage Attachment via FileStreamResult

I have this code here where I retrieve an attachment from an Email Message that is on the Exchange Server using EWS Attachment attachment = message.Attachments.Single(att => att.ContentId == Request.QueryString["cid"]); attachment.Load(); FileAttachment fileAttachment = attachment as FileAttachment; ...

What is the base of all interfaces in .net, just like the base for all classes is the object

I would like to pass an interface to a method signature which takes Object as its parameter, so I wonder about this question public Stream GetViewStream(string viewName, object model, ControllerContext context) instead of object I shall like to pass an interface Imodel, without modifying the signature. Is there a base class for inter...

Is the Nerddiner walk-through suitable for ASP.NET MVC 2?

I'm keen to teach myself ASP.NET MVC 2 (coming from a heavy embedded or rich GUI background). If have found the nerddiner walk-through but it is still for ASP.NET MVC 1. The codeplex downloads have been updated to MVC 2 but the link for the PDF goes back to the MVC 1 book. Is it even possible to follow the walk-through in MVC 2? If s...

MVC2 - Route mapped but QueryString rendered

Hi there, in my Asp.net MVC2 app I have registered the following routes in the global.asax.cs: routes.MapRoute( "Search", "Search/{action}/{category}/{query}/{page}", new { controller = "Search", action = "Results", category = "All", page = 1 }, new { page = @"\d{1,8}" } ); // URL: /Search routes.MapRoute( "S...

The wrong of two ValidationSummaries gets updated (inside of a partial view)

In my little app I've a strongly typed partial view (the Login Form) this is rendered within the Masterpage, this looks as follows: <!-- Login Box --> <div class="login"> <div class="login-bg clearingfix"> <% Html.RenderPartial("LoginViewControl", Model); %> </div> </di...

MVC2 forms auth not using cookies by default?

I'm building a site and doing all my tests on the built-in development server of Visual Studio. Things were working just fine but at some point my site stopped using cookies after logging in using forms. Junk was being placed in the URL string and cookies weren't being set. Session variables were being set but apparently those did not ho...

Install mvc2 on a server

Hello, im on the microsoft download center to download mvc2. But here i see three links and i have doubts what is what i need: http://www.microsoft.com/downloads/details.aspx?FamilyID=c9ba1fe1-3ba8-439a-9e21-def90a8615a9&amp;displaylang=en#Requirements release notes MV2 for visual studio 2008 A test project of MVC2 From wich plac...

I want to update the database straight away from a grid that includes checkboxes

I am new to MVC and I am wondering how to do the following; Using a foreach loop and a user control I am happily displaying a list of users from a database. This page is an admin page, and the associated permissions for each user are displayed. I want to change this so that under each heading for each role there is a checkbox that determ...

What is the fastest way to convert all PK and FK GUID Columns and relationships to int?

I'm currently developing an ASP.NET MVC application with a ton of PK-FK relationships in the database. In the beginning of development, the team I WAS working with voted against my recommendation to use INTs for all PKs... they decided to use GUIDs. Long story long... the team has split ways, and now I have control to change things... ...

Attaching to click event (with jQuery) on submit button kills submission function.

The full story is I want to disable the submit button on a form's submission to prevent multiple submissions. One of the problems is the form is an ASP.Net MVC Ajax form - <% using (Ajax.BeginForm ... %> - so its javascript onSubmit event is already set and I therefore cannot do this during that event. Unless there's a way to add to the ...

Using Workflow 4 as a Controller in MVC

Hi I'm building an app that deals with customer queries, where I want to route the query through a decision tree showing appropriate views before taking some automated action against their query. Kind of like the game "20 questions"! Based on the answers at each stage, the path through the app will change. I was thinking of using MVC, ...

Template/Data/Model context for an empty list ASP.NET MVC2

I've created a view for adding/removing items for a list. I'm trying to handle adding/removing dynamically, but I'm unclear on how to get the proper template context when the list is empty. The view is based on: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Service.Cms.ListItems; namespace...

Jquery post recieves data from controller but won't render

I have controller method in my MVC application that I am calling using the jQury $.post.... The call is executing correctly, processing and sending a valid result back to the view for rendering. If I alert the result everything is received on teh client as expected but the data is not rendered to the view. The controller mehtod is as ...

Accessing custom principal within a custom ActionFilterAttribute

I am working on an ASP.NET MVC application. I have implemented custom membership provider, principal and identity. In the custom provider I replace the HttpContext.Current.User in the ValidateUser() method as follows: public sealed class CustomMembershipProvider : MembershipProvider { ... public override bool ValidateUs...

Castle Windsor and Fluent Validation as an MVC Validator

I have setup my MVC project to use Fluent Validation and Castle Windsor and everything is working wonderfully. I am using a custom Validator Factory to take into account that I am also using Entity Framework and have to account for the dynamic proxies that get wrapped around my POCO classes. Here is my CastleWindsorValidatorFactory: p...