asp.net-mvc-2

ASP.Net MVC 2.0: EditorFor setting name via attributes

Hey guys Just wondering how do I mimic the following using attributes... <%= Html.EditorFor(x => x.SportProgramIdList, "FormMultiSelectDropDownList", "SportProgramIds")%> I know I can specify the template by using [UIHint("FormMultiSelectDropDownList")] but I am left with the problem with how to set the name... Cheers Anthony ...

Javascript top banner control

Possible Duplicates: How to show popup message like in stackoverflow Header message just like at Stack Overflow How to display a message on screen without refreshing like SO does? I'm looking for something like StackOverflow's banner that pops up (or rather drops down) from the top of the screen when you have a new alert. ...

New ASP.NET MVC 2 ViewMasterPage error

Im trying out ASP.NET MVC 2 and have immediately hit a problem with my first application.When adding a View Master Page I get the following warning in VS 2008: \Views\Shared\ViewMasterPage.Master: ASP.NET runtime error: The specified module could not be found. (Exception from HRESULT: 0x8007007E)Why is this? The System.Web.Mvc dll is in ...

Strongly Typed ActionLink In Asp.Net MVC 2?

I just downloaded VS.NET 2010 RC and created a new MVC project. It would seem that strongly typed ActionLinks are not in this release? Is this always going to be a "futures" thing? Or am I missing something? <%=Html.ActionLink<HomeController>(x => x.Index(),"Home")%> ...

asp.net mvc 2 UIHint with multiple defonitions

hi there. im using data annotation with buddy classes for error etc however i have a field for photo on the view it should be an image but on the edit and add it should be a file upload ??? but UIHint will only let me have one, so how do you have multiple UI for one type in your class? thanks ...

How do i get ninject 2.0 working with asp.net mvc 2?

Hello, i am using:- asp.net mvc rc 2 Ninject and ninject asp.net mvc extension (http://github.com/enkari/ninject.web.mvc) i keep getting the 'No parameterless constructor defined for this object.' for my AccountController. The AccountController is injected with Services. The bindings for these services are defined in the ServiceModu...

ASP.NET MVC Multi Project Areas Questions with setup

Hello, For those who setup muli project areas in ASP.NET MVC 2 in VS 2010, I have a few questions for you: Can other project areas use one master page? Or does each have to have their own master page? What about the web.config file? Does each area need the config file? Or does it rely on the master? I tried removing the master page...

how do i call a javascript subroutine from mvc server side code?

basically what the title says, i know you can return a javascript view but this has never worked for me. i couldn't find a proper tutorial or explanation about this concept either, if anyone can shed some light on it that would be great (yep, ive tried google countless times). thanks edit: ive used your tips, debugger etc... thanks gu...

ASP.NET MVC 2 Data annotations in a dynamically generated model

Hello everyone, I am creating an asp.net mvc 2 application generating my view model dynamically depending on user input. Simply put, the user is able to choose which fields he wants to see in his View. Since the templated helpers rely heavily on model properties and attributes (data annotations), I would need to somehow add the attribu...

Validation not working on ViewModel

Ok, I have a ViewModel that looks like this: public class UserLogin { [Required] public string EmailAddress { get; set; } [Required] public string Password { get; set; } } My controller looks like this: [HttpPost] public ActionResult LogIn(UserLogin model) { if (!ModelState.IsValid) { // ... } } ...

ASP.net-MVC2 RC2: jQuery 1.4.1 and dateTime evaluation

Im trying to incorporate jQuery plugin FullCalendar into my application. All was going well until i decided to implement the dropping of a calendar event in the calendar. for this i hooked up the following code to the eventDrop eventhandler (jquery / clientside) eventDrop: function( event, dayDelta, minuteDelta, allDay, re...

BinaryWrite exception "OutputStream is not available when a custom TextWriter is used" in MVC 2 ASP.NET 4

Hi, I have a view rendering a stream using the response BinaryWrite method. This all worked fine under ASP.NET 4 using the Beta 2 but throws this exception in the RC release: "HttpException" , "OutputStream is not available when a custom TextWriter is used." <%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPa...

Struggling with SelectList in ASP.NET MVC 2

I have a model that looks something like this: public class SampleModel { public static SampleModel Create() { return new SampleModel { Boolean = true, // set several more properties... Colors = new SelectList(new[] { "Red", "Green", "Blue" }, "Green") }; } pub...

ASP.NET MVC 2 actionlink breaking after migration from MVC version 1

Hi, I am migrating my application from asp.net mvc to mvc version 2 and am having the following issue. I have paging links << < > >> that I include in each page. Like so: <% Html.RenderPartial("PagingControl", Model); %> They exist in an ascx file as follows. <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserContr...

ASP.NET MVC 2 - Views in separate assembly - No intellisense

Hi, I've searched over the topics on Stackoverflow but this question hasn't been answered so far. I have two projects in my solution: a) MVC Application b) Class Library. The class library acts as a plugin, so it contains views. The main problem is that I have no intellisense in the view's markup for my classes contained within the cla...

Simple Asp.Net MVC2 Binding question: How to get an EditorFor to render a Radio Button Group?

Just thinking out loud about the subject, If I have the following: <%= Html.EditorFor(m => m.Gender, "Gender") And I want it to render two radio buttons: O Male O Female Assuming the class just has a string to hold the value, what would the Gender.ascx look like if we were to pass the Gender values using something like ViewDat...

Custom model validation of dependent properties using Data Annotations

Since now I've used the excellent FluentValidation library to validate my model classes. In web applications I use it in conjunction with the jquery.validate plugin to perform client side validation as well. One drawback is that much of the validation logic is repeated on the client side and is no longer centralized at a single place. ...

Does ASP.NET MVC 2 get installed with .Net Framework version 4?

I am attempting to deploy an asp.net MVC 2 Application on IIS 6 (windows server 2003), I can access the website looking at a basic html page but it seems that MVC is not working. I am assuming that MVC 2 is installed with version 4 of the .net framework? The MVC IIS6 walkthrough here http://haacked.com/archive/2008/11/26/asp.net-mvc-on-...

Why is all my content disappearing when I turn on client validation in ASP.NET MVC 2 RC2?

I am using the following partial to render the editor for the Create and Edit pages: PersonEditor.ascx <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyProj.ViewModels.PersonEditorViewModel>" %> <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript" /> <script src="../../Scripts/MicrosoftMvcValidation....

Bug? Client-side validation in ASP.NET MVC 2 causes ValidationSummary message to show even if there is no error

With client-side validation turned on in ASP.NET MVC 2 RC2, the validation summary message is visible even when I first load my Edit.aspx page. It does not show in bold red, however, just plain text. If I submit the form with an error, then the validation summary message turns bold red, and a list of errors appears below. Here is the co...