asp.net-mvc-2

How to route lower-case URLs ('questions/add_to_favorites/123') with underscores in ASP.NET MVC2?

ASP.NET MVC 2 controllers and actions use UpperCamelCase. For some reasons many big sites, including SO, use lowercase (with underscore) for controllers and actions in the urls. Examples: http://stackoverflow.com/questions http://stackoverflow.com/users/377920/randomguy http://www.reddit.com/ad_inq/ http://www.wired.com/special_multime...

MVC Music Store tutorial in VB?

Hi, I'm working through the MVC Music Store in Visual Basic (mvcmusicstore.codeplex.com), trying to convert things as I go. I'm heving trouble with some of the lambda expressions in the Views, however. Specifically, on page 53 when the Album editor template is used, I am not seeing my editor template when I use the following code: Orig...

ASP.NET MVC 2EditorFor not generating the correct name attributes

Hi, I have the following EditorFor template: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<ContactDto>>" %> <%@ Import Namespace="c2.bases.dto.structure"%> <% for (var i = 0; i < ViewData.Model.Count; i++) {%> <%=Html.EditorFor(x => x[i])%> <%} %> The problem is that it is not generating...

Passing messages to the user in MVC2

I am using ASP.NET MVC2 for my project. I want to send the user confirmation messages after actions. Ideally: User clicks on a link with a query string (i.e. a link to delete an entry) The controller does what the link says, creates the success message, and uses RedirectToAction to get rid of the query string from the URL. The new actio...

Error with View outside Views folder

I'm trying to add a View to an arbitrary folder in my MVC project (~/SomeOtherViewDirectory). This works fine until I modify the View to use be strongly typed. Ie, if the page inherits from System.Web.Mvc.ViewPage, it compiles and runs fine, but if it inherits from System.Web.Mvc.ViewPage it does not. When I turn page compilation on...

Is there a good way to create render a blank slate for a page in ASP.Net MVC?

I have an index page which shows a paged list of data from a database. When that list is empty, I want to show a "blank slate" view that clearly indicates to the user where they are and what they can do there: "You can add a new item by clicking here" type of thing. Is there a better/cleaner way to do this than just having a big if stat...

Will the MVC 2.0 assemblies compiled against 3.5 and 4.0 live side-by-side in the GAC?

We are upgrading some of our VS2008 solutions to VS2010, but we are not yet prepared to go to .NET 4.0 on all our projects. At the same time, we are looking at a move from MVC 1.0 to 2.0. I know that there are MVC 2.0 assemblies/code compiled against both the 3.5 and 4.0 .NET Frameworks, but will these two MVC versions live side-by-sid...

ASP.NET MVC2 DataAnnotaion Validation within an updatepanel

I am currently working on a website using MVC2 and using ASP.NET Ajax to handle moving between pages. Everything is working fine except a page that has a form for the user to fill out that uses DataAnnotations for validation. This form falls within my UpdatePanel and won't conduct server or client side validation, both which I have worki...

ASP.NET MVC and ASP.NET Membership: implementing email address validation after user registration

I'm building an ASP.NET MVC 2 site, where I want to have users verify their email address after they register. I want to send an email to the address with a link that the user can click to verify their email, and then handle the clicking of that link (the link will contain a specific id, of course). Of course, this is easy to manually ...

.NET MVC 2.0 Custom Model Binder not called when using SWFUpload

I am uploading files using SWFUpload. To get the data I need passed along with the file, I am adding post params to swfupload. The problem is that the custom model binder I have written is not called when the controller method is called by swfupload. Some of the properties of my model are set, but not the properties controlled by my c...

Custom Data Annotations IsValid is never invoked. (ASP.NET MVC 2 .NET 4)

I have a custom Data Validation Attribute I've created to make sure the passwords a user inputs are the same, but IsValid is never invoked. Custom attribute: public class IsSameAsAttribute : ValidationAttribute { public String TargetProperty { get; set; } private readonly object _typeId = new object(); public IsSameAsAtt...

What is the best way of making a mobile version of a site in asp.net MVC2?

I've been thinking about this recently and I don't know a really nice and tidy way of creating a mobile version of an existing or new MVC2 website/app. I think the easiest way would be to just use a different stylesheet depending on whether a mobile was detected but sometime you need to change the view content too if you have massive in...

Using MS Ajax Minfier 4.0 for Asp.Net MVC 2.0?

I am planning to use MS Ajax Minifier with Asp.Net MVC 2.0 for handling the Js and Css files. Does anyone has experience with MS Ajax Minifier? I have following questions regarding this. Is it the best way to use JS/CSS files in Asp.Net MVC or is there a better way. E.g. YUI Compressor, Telerik Extension for MVC? As I understand we ca...

can i change the way LabelFor render in MVC?

hi! i would like to change the way LabelFor render. Can i do that with a DisplayTemplate? LabelFor generate a label tag and i would like to add a ":" at the end of the label. thank you! alex ...

ASP.Net MVC 2.0 Validating disabled input fields

My MVC validation is failing on disabled form fields - saying that they are required, even though these disabled input fields have values set. I read this http://weblogs.asp.net/imranbaloch/archive/2010/06/20/disabling-client-side-validation-for-disabled-input-controls-in-asp-net-mvc.aspx which explains how to modify the MicrosoftMvcVal...

ASP.NET MVC 2 Popup dialog - performance and strange behaviour

I use this in my Index.aspx: <%= Html.StandardOverlayCreateButton() %> <div class="apple_overlay" id="overlay"> <div class="contentWrap"> </div> </div> Which is translating into this: <a href="Employee/Create" rel="#overlay"><button type="button">Create</button></a> <div class="apple_overlay" id="overlay"> <div class="con...

Facebook Markup Language & .NET MVC 2.0

I am creating a .NET MVC (1.0) facebook application using FBML. Everything is working like expected. However, if I simply change the project to reference the System.Web.Mvc 2.0 assembly, the application stops working. No exceptions are thrown (it makes it through the controller class fine) but nothing is rendered on the page? Any ide...

Re-use route parameter on url

How do I make my application route to mydomainname/username/controller. I am working on asp.net mvc web application that enables a user to belong to multiple account. ie. In the application every account has its own users, and each user in one account can also be a user in another account. What i need is when a user wants to login, the...

How can I pass parameters to an Action using Html.Action() in ASP.NET MVC?

Hello SO Community, I've been using Html.Action("ActionName", "ControllerName") to invoke child actions across controllers without needing to have the view in Views\Shared. This has been working great for displaying things like session or cookie information. Instead of just accessing cookies, I would like to pass additional parameters ...

ASP.NET MVC 2: ViewData.Model.ExecuteResult not existing

ViewData.Model.ExecuteResult does not exist in ASP.NET MVC2, but in MVC1. What is the alternative in ASP.NET MVC2? What I want to do, is to update a table after an ajax request. So I put the table in an extra View. How can I update this partial view without loading the whole page again? ...