asp.net-mvc-2

Syntax to specify Namespace when using helper.RouteUrl

I am using Asp.Net MVC 2 - RC w/ Areas. I am receiving an ambigious controller name exception due to having same controller name in two different areas. I've read Phil Haack's post Ambiguous Controller Names With Areas I can't figure out the syntax when trying to use UrlHelper (I have an extensions class). e.g. public static string ...

Has anyone implement RadioButtonListFor<T> for ASP.NET MVC?

There was an Html.RadioButtonList extension method in ASP.NET MVC Futures. Has anyone found a code for a strongly typed version RadioButtonListFor<T>. It would look like this in a view: <%= Html.RadioButtonListFor(model=>model.Item,Model.ItemList) %> ...

Persisting complex data between postbacks in ASP.NET MVC

I'm developing an ASP.NET MVC 2 application that connects to some services to do data retrieval and update. The services require that I provide the original entity along with the updated entity when updating data. This is so it can do change tracking and optimistic concurrency. The services cannot be changed. My problem is that I need t...

How to use and/or localize DisplayAttribute with ASP.NET MVC2?

I am trying to figure out how to get the DisplayAttribute in my MVC 2 ViewModel to work with the Html.LabelFor() helper. Neither public class TestModel { [Display(ResourceType = typeof(Localization.Labels))] public string Text { get; set; } } nor public class TestModel { [Display(Name = "test")] public string Text { ...

ASP.NET MVC - Refresh PartialView when DropDownList changed

I have a search form that is an Ajax form. Within the form is a DropDownList that, when changed, should refresh a PartialView within the Ajax form (via a GET request). However, I'm not sure what to do in order to refresh the PartialView after I get back my results via the GET request. Search.aspx <%@ Page Title="" Language="VB" MasterP...

Putting CAPTCHAs on their own page?

We need to put a captcha image on our ASP.NET MVC 2 based website. We chose reCaptcha and built it in using the way described by Derik Whittaker. The idea there is baiscally to build some abstractions and all you need to do is decorate your Controller with a [ValidateCaptcha] attribute. This works all fine. However, we have a lot of for...

ASP.NET MVC 3 - What features do you want to see?

I know a bunch of people that are really enjoying the improvements that ASP.NET MVC 2 made over the first release. I have just started to migrate our MVC 1 project over and so far areas has totally cleaned up the subfolder mess we had in our large scale application. As I dive deeper into all the improvements and changes that were made ...

ASP.NET MVC - PartialView html not changing via jQuery html() call

When I change the selection in a DropDownList, a PartialView gets updated via a GET request. When updating the PartialView via the jQuery html() function, the html returned is correct but when it displayed in the browser it is not correct. For example, certain checkboxes within the PartialView should become enabled but they remain disabl...

Using ASP.NET MVC 2 with Ninject 2 from scratch

I just did File -> New Project last night on a new project. Ah, the smell of green fields. I am using the just released ASP.NET MVC 2 (i.e. no preview or release candidate, the real thing), and thought I'd get off to a good start using Ninject 2 (also released version) with the MVC extensions. I downloaded the MVC extensions projec...

Is MVC 2 client-side validation broken in Visual Studio 2010 RC?

I can't seem to get client side validation working with the version of MVC released with Visual Studio 2010 RC. I've tried it with two projects -- one upgrade from 1.0, and one using the template that came with VS. I'd think the template version would work, but it doesn't. Added the following scripts: <script type="text/javascrip...

How to define PK & Fk relationships using MVC Security Tables & Views using Linqtosql

I am trying to physically do the PK & FK relationships below using the MVC Security tables & Views to connect the loggedon (UserId, UserName & Email) to the Profile Table where I will save (FullName, TimeZone, Picture). I understand all the related coding but have been unable to use the Security View(vw_aspnet_MembershipUsers) properly i...

ModelBindingContext ModelName

Can anyone explain where the ModelName gets populated from? Looked in MSDN documentation and no explaination here. I am creating a custom model binder and within it I get null for the following: var result = bindingContext.ModelName); ...

Does anyone know the work arounds to use the new Chart Controls with ASP.NET 4.0 MVC?

It seems as though there is much to do in order to simply use the chart control using MVC 2 versus WebForms. I am guessing that now that you can combine WebForm with MVC 2 in ASP.NET 4.0 this will be less problematic, but I really want to know if someone has a list of the steps to leverage the chart controls on an MVC View. Surely if I...

How to initiate JavaScript Callback with MVC2 using RenderAction

I am building a dashboard where I am iterating through a list of controls to render, and I need to initiate a general callback both after each control and after they are all completed. I was curious what the best way to handle this is. I can get the control specific callback fired off by placing myUserControlCallback(); in the user co...

How do I generate a RouteLink to a route in a different area?

I have two different areas, and I have a route in one of those areas that is specific to that area, but I need to generate a link to that route using Html.RouteLink from another area (it's how you get over into the new area) but it won't work... It doesn't seem possible to use RouteLink to routes in a different area. What is the best w...

Adding items to Model Collection in ASP.NET MVC

In an ASP.NET MVC application where I have the following model.. public class EventViewModel { public Guid Id { get; set; } public List<Guid> Attendants { get; set; } } passed to a view... public ActionResult Create(EventViewModel model) { // ... } I want to be able to add to the "Attendants" Collection from the View. The code ...

Implementing a normal website inside ASP.NET MVC 2

I have a website consisting of an index.html, a number of style sheet files as well as some javascript files. Then I needed a way for this site to communicate efficiently with a Microsoft SQL Server, so I was recommended to use the MVC framework to facilitate that kind of communication. I created the C#.net controller code needed to outp...

Properly registering JavaScript and CSS in MVC 2 Editor Templates

How do I properly register javascript blocks in an ASP.NET MVC 2 (RTM) Editor template? The specific scenario I'm in is that I want to use Dynarch JSCal2 DateTimePicker for my standard datetime picker, but this question is in general to any reusable javascript package. I have my template working properly now but it has my JS and CSS inc...

Why use ASP.NET MVC 2 for REST services? Why not WCF?

So I see that MVC 2 now supports [HttpPut] and [HttpDelete] as well as [HttpGet] and [HttpPost], making it possible to do a full RESTful Web service using it. I've been using the REST toolkit for WCF for a while and find it fairly powerful, but I'd be interested to find out what (if any) advantages there are using the MVC 2 approach. ...

How do I create a selection list using checkboxes in ASP.NET MVC?

I have a database table that records what publications a user is allowed to access. The table is very simple - it simply stores user ID/publication ID pairs: CREATE TABLE UserPublication (UserId INTEGER, PublicationID INTEGER) The presence of a record for a given user & publication means that the user has access; absence of a record i...