asp.net-mvc

How to change the template for the ValidationSummary

In ASP MVC (RC 1), how can I change the default template for ValidationSummary? By default it ValidationSummary() shows a bullet list of errors in red. How can I change this? (i.e Have images instead of bullets) ...

How to maintain state of Html.CheckBox() in ASP.NET MVC

I have two checkboxes in my MVC app which are both boolean / bit fields. "NotifyEmail" & "NotifySMS". Whenever I post back to the server and an error occurs, the state of the checkbox is gone event though I set attempted values. ...

How do I apply conditional logic to determine which master page to display in asp.net?

I have 2 master pages and a single content page. How do I show employees one master page and customers a different one? This is for an asp.net mvc app. ...

Whitelist Model Binding doesn't seem to work with complex properties

I have a POST action that looks like this: public ActionResult Create([Bind(Include="userrole,credentials.emailAddress,credentials.password")]User u, string confirmPassword, bool agreeToTerms) I'm using the default model binder and credentials is a property on my User object. Credentials has two fields (emailAddress & password). If I ...

Does PartialView do what I think it should (but doesn't)?

I have a div on an ASP.NET MVC page that I would like to populate dynamically (at user request) using jQuery. I currently have jQuery placing a JSON call to my controller, which returns a JSON object, and then I use Javascript to build the HTML manually, which is then placed in the div. Hang on a minute. Wouldn't it be much easier to ...

Passing multiple result sets to a view from a controller in ASP.NET MVC?

So I have a controller set up as follows: using NonStockSystem.Models; namespace NonStockSystem.Controllers { [Authorize(Users = "DOMAIN\\rburke")] public class AdminController : Controller { private NonStockSystemDataContext db = new NonStockSystemDataContext(); public ActionResult Index() { ...

Get Html from a Url in ASP.NET MVC

I need to save a page from url - This page is in my own application - in html format. This html will then be send by email to a user. Any anyone knows how? ...

Good MVC projects

I'm thinking of building a small web app using the MVC framework as a way to introduce myself to it. The idea of a project to get myself started is a small gambling monitoring piece of software that I can enter a a list of all my small bets I have along with other friends. Some of the things I hope to capture using this web app is: - log...

Does ASP.NET MVC RC has a strongly typed RedirectToAction method already?

Since I have decided to let RC go while staying with Beta for now, I have no way of knowing whether there has been some progress in this area. Who has tried it, are there strongly typed RedirectToAction and maybe ActionLink in RC? (I know there is some extra stuff in Futures assembly, but the question really refers to the main build). ...

What to put in your ViewModel

And what do you put in your View? A recent blog from Scott Hanselman about using a special model binder for easier testing led me to think about the following: What do you put in your controller logic building the view model, and what should be put in the view? what he does is this: var viewModel = new DinnerFormViewModel { Dinne...

How can I create a local user profile for the anonymous user of an ASP.Net MVC application under IIS 7?

I've been experimenting with ASP.Net MVC, and have come across a problem that is probably not specifically MVC related. But I cannot get the authentication in the default MVC application (the one created by the wizard when you create a new MVC project) to work properly under IIS 7 on Windows 7. If I run under the Visual Studio environme...

Caching in the ASP.NET MVC Framework

I am fairly new at using the ASP.NET MVC framework and was hoping that I could find some help about best-practises when caching various parts of my MVC web application. I know that stack overflow uses MVC and some pretty freeking awesome caching techniques, and its MILES faster than my app, even when running locally. I have a few quest...

Best OpenId API for ASP.NET MVC application

I am developing an ASP.NET MVC application and I want to use OpenId. What is the best option? DotNetOpenId RPX Other??? Does anyone know what StackOverflow uses? Is the Login UI custom-developed, or provided by an API/service? ...

Passing data in ASP.NET MVC using LINQ - nuttiness

Allow me to start with: I am a n00b on ASP.NET MVC. I love it, but I am a n00b. I am trying to pass "complex" data back from a LINQ query. I understand how to use the data context and then just cast that data when I send it back, but when I do a more complicated LINQ query which returns an anonymous type, things break down. I saw som...

What are the most important things to test in an ASP.NET MVC application?

Most of the stackoverflow posts about ASP.NET MVC unit testing talk about a specific issue or specific thing to test such as testing HtmlHelpers. Others on the subject of best practices have surprisingly few answers. Available videos I have watched are completely useless in my opinion - and mind blowingly long (by the time you've watched...

ASP.NET MVC multiple controller actions in one form

Hello. I might have wandered into wrong direction so please help. I have a page in my ASP.NET MVC application which displays comments. These comments come from 'Index' action of 'Comments' controller. At the bottom of the page I have a form for adding new comments. This form should call [AcceptVerbs(HttpVerbs.Get)] public ActionRes...

Type exists in two libraries

I'm trying to incorporate Linq to Lucene in my Asp.net-mvc project. As with most web projects, I use the PagedList type I put in my personal helper library and use it all over the place. But so did Linq to Lucene... Since both my library and the L2L library want to add the PagedList type to System.Collections.Generic namespace, I get a c...

Silverlight 2 getting membership/identity information from MVC application

Hi there, I have an MVC application that among other things contains a small Silverlight menu that is displayed as part of the .Master page used in most pages. I have also written a MembershipProvider (and a role provider) that uses my app's database for authenticating and authorizing users. Works fine. However, I want the Silverlight...

When upgrading to MVC beta to RC1 the application suddenly crashes where it shouldn't crash

When we upgraded MVC beta to MVC RC1 the development webserver that visual studio has suddenly crashed at some point in the application. After some searching I narrowed the bug to this simple line: if (!helper.ViewData.ContainsKey("SomeString")) SomeString is at that moment present in the viewData so the if statement should return fal...

MVC DateTime binding with incorrect date format

Asp.net-MVC now allows for implicit binding of DateTime objects. I have an action along the lines of public ActionResult DoSomething(DateTime startDate) { ... } This successfully converts a string from an ajax call into a DateTime. However, we use the date format dd/MM/yyyy; MVC is converting to MM/dd/yyyy. For example, submitting a...