asp.net-mvc

Site-Wide Filters in ASP.NET MVC

What is the best way to enable site-wide filters in an ASP.NET MVC application? To clarify, I have a form in my master page which has a drop down list =, the value of which filters every page on the site. Each individual page also has it's own form elements. I'd really rather not have a form element across the whole page (a la vanilla...

Good simple MVC and JQuery ASP.NET application?

Any ideas on a good working sample application which uses MVC and JQuery together? Something like a starter kit. I am not into something that's "half baked" or a CodePlex work-in-progress type of app. I prefer a complete simple app than a more complex unfinished app. Also one which uses the latest MVC preview is a plus. I hope I am not ...

What's the difference between ASP.Net MVC Routing and the new ASP.Net DynamicData Site routing?

I've only started playing with both ASP.Net MVC and the new-to-VS2008 Dynamic Data Website Templates. I note that they both use routing in their URL handling, and I'm given to understand that because of routing, ASP.Net MVC won't work under IIS6. However my DynamicData site works just fine on IIS6. I've had to temporarily abandon my e...

How can I avoid duplicate content in ASP.NET MVC due to case-insensitive URLs and defaults?

Edit: Now I need to solve this problem for real, I did a little more investigation and came up with a number of things to reduce duplicate content. I posted detailed code samples on my blog: Reducing Duplicate Content with ASP.NET MVC First post - go easy if I've marked this up wrong or tagged it badly :P In Microsoft's n...

Asp.net Project Ideas?

Hello, I've recently decided to step-up my knowledge in ASP.NET (I haven't coded in ASP.NET for about 2 years or so, and much has changed since then). I want to work with the new MVC framework, try jQuery, LINQ to SQL and basically just to catch up with most of the up-to-date features. To do that, I want to start a nice project in ASP...

Difference Between ViewData and TempData?

I know what ViewData is and use it all the time, but in ASP.NET Preview 5 they introduced something new called TempData. I normally strongly type my ViewData, instead of using the dictionary of objects approach. So, when should I use TempData instead of ViewData? Are there any best practices for this? ...

Best Template Engine for ASP.NET MVC

I am exploring ASP.NET MVC and I wanted to add jQuery to make the site interactive. I used StringTemplate, ported to .Net, as my template engine to generate html and to send JSON. However, when I view the page, I could not see it. After debugging, I've realized that the $ is used by the StringTemplate to access property, etc and jQuery u...

ASP/NET MVC: Test Controllers w/Sessions? Mocking?

I read some of the answers on here re: testing views and controllers, and mocking, but I still can't figure out how to test an ASP.NET MVC controller that reads and sets Session values (or any other context based variables.) How do I provide a (Session) context for my test methods? Is mocking the answer? Anybody have examples? Basically,...

Asp.Net MVC: Is there support for controller level filter attributes?

Hi, I have a filter attribute that I'd like to be applied to every action on my controller. Is there a built in mechanism to support this? Right now, I'm manually adding the filter to each action, but that's error prone and tedious. If there isn't support for controller level filter attributes, is there a better way to perform the log...

grid controls for ASP.NET MVC ?

If you are using ASP.NET MVC how are you doing grid display? Rolled your own? Got a library from somewhere? These are some of the known grid display solutions I have found for ASP.NET MVC ASP.NET MVC Flexgrid - Has nice column layout method Code based ASP.NET MVC GridView - simple, small, clean MVC Contrib - grid from codePlex jQue...

Html.TextBox conditional attribute with ASP.NET MVC Preview 5

I have a strongly-typed MVC View Control which is responsible for the UI where users can create and edit Client items. I'd like them to be able to define the ClientId on creation, but not edit, and this to be reflected in the UI. To this end, I have the following line: <%= Html.TextBox("Client.ClientId", ViewData.Model.ClientId, new {...

In ASP.NET MVC I encounter an incorrect type error when rendering a page with the correct typed object

I am developing an application using MVC Preview 5. I have used typed views. After setting debug="false", I have found that I am receiving errors of the form: "The model item passed into the dictionary is of type 'blah.Models.UserAdmin.IndexData' but this dictionary requires a model item of type 'blah.Models.OrganisationA...

Has using the HttpRuntime.Cache changed in ASP.NET MVC?

So, I was looking over my standard cache utility when preparing to unit test a controller and thought, hey, is accessing the HttpRuntime.Cache directly considered harmful in MVC? I wrap the cache in a proxy class that implements a cache-like interface (tho much simpler) so that I can mock it during tests. But I'm wondering if that's al...

Should I Learn NHaml?

Should I learn NHaml? What does it provide me over a classic ASP.NET MVC view? What are the pros and cons? Are you using it via the MVC Contrib project? I have been seeing more and more about it. For example... I saw a blog post by Matthew Podwysocki using ASP.NET MVC, NHaml, and F#! ...

ASP.NET MVC + ORM

I am in the start up of a project using ASP.NET MVC and have started creating my models. Since I know some Ruby On Rails and would like to use a system as similar to Rails Active Record as possible. Have anyone used Castle Projects Active Record in a ASP.NET MVC application (or any application that is relevant) and have some experience ...

Return to referring page

I am using an authentication attribute on some of my actions in an asp.net mvc page to refer people to a login screen if they have not authenticated. My problem is returning them to the referring page after they have logged in. I was just keeping track of the referring action and referring controller but that becomes problematic when I...

LINQ to SQL Table Dependency

If I have two tables... Category and Pet. Is there a way in LINQ to SQL to make the result of the joined query map to a another strongly typed class (such as: PetWithCategoryName) so that I can strongly pass it to a MVC View? I currently have Category and Pet classes... should I make another one? Maybe I missing something here. Can a...

Web App to best Add, Delete and Edit rows without refreshing the page

I am writing a Time Sheeting web application that involves users entering their tasks for the week. I would like not to have the page refresh so I am exploring ways to add/delete/edit tasks using JavaScript on the client browser. Currently I am using ASP.NET-MVC, Ajax, JQuery and LiveValidation and I am make steady (if slow) progress. ...

Alternative to Html.Button<T>?

I know the Html.Button has been moved to the Microsoft.Web.Mvc namespace, but I really miss the generic versions that used to exist in the early Previews. All I want the Html.Button to do is to hit an action in my controller, but I'd rather not write the JavaScript in the onClickMethod argument. In my previous project I just snagged t...

ASP.NET MVC in a virtual directory

I have the following in my Global.asax.cs routes.MapRoute( "Arrival", "{partnerID}", new { controller = "Search", action = "Index", partnerID="1000" } ); routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" } ); My SearchController looks like this publ...