asp.net-mvc-2

I want to debug an ASP.NET MVC app in IIS using a custom URL defined in HOSTS

I am having trouble setting up VS2010 so I can debug in IIS: I have added some custom URL's to HOSTS I have edited the application properties to use local IIS I have created a virtual directory in IIS Any good resources fro setting this up? ...

MVC2 JQuery Syntax not working

Hi, newby here in MVC2, so please excuse my stupidity, But I really need help. I am trying to do the following : <script src="Scripts/MicrosoftAjax.js" type="text/javascript"></script> <script src="Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script> <script src="Scripts/jquery-1.4.1.min-vsdoc.js" type="text/javascript"></scri...

Can't bind to parameter

I've got the default routing: routes.MapRoute( "Shortie", // Route name "{controller}/{id}", // URL with parameters new { controller = "Ettan", action = "Index", id = "id" } // Parameter defaults ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{...

How to get to the parent object in an editortemplate?

In a custom editor template I want to access the parent object. I'm using this code but this is probably not the best way to do it, especially when using nested views: object parent = ViewContext.Controller.ViewData.Model; Does anybody have a better idea? ...

OData implementation for ASP.NET MVC

We have a fairly straight forward line of business application implemented with ASP.NET MVC2 and we have a new requirement to be able to share our data with other parts of the business, which include SharePoint 2010, Ruby and Python. I'd like to use OData as the transport mechanism (as opposed to SOAP) using our existing MVC application...

Observer Pattern or just create event handling?

I want to create a "modules" layout in my web application so I can easily add more modules of the same type, for example: As an example, my WebApp handles subscriptions and email campaigns, and I want to create an interface to allow easily coupling multiple API's, MailChimp, CampaignMonitor, iContact, etc... so I will create an IMailin...

Microsoft.Web.Mvc.LinkBuilder.BuildUrlFromExpression failing when testing Asp.net MVC app

So I'm trying to unit-test a controller method. I'm using MSTest in VS 2010, and Moq 3.1 Test method: [TestMethod] public void TestAccountSignup() { var request = new Mock<HttpRequestBase>(); var context = new Mock<HttpContextBase>(); AccountController controller = new AccountController(); ...

NHibernate one-to-many delete

I am working on an ASP.NET MVC application using NHibernate as the ORM. I have two domain objects: public class Contact { public int ID { get; set } public string Name { get;set; } public IList<ContactNumber> ContactNumbers { get; set; } } public class ContactNumber { p...

Spring.Net: Inject ApplicationContext / ObjectFactory itself

Hi Is there a way to pass the IObjectFactory or the ApplicationContext that is currently executing as dependency to an object? For example <object id="SpringActionInvoker" type="xxx.SpringActionInvoker, xxx"> <constructor-arg ref="reference_to_the_ApplicationContext_or_ObjectFactor_that_is_executing" /> </object> I want to us...

selected list item in MVC 2.0

Hello, i inherited a menu based on lists that was used before i started and that needs going into MVC. The list needs to show a white box for the selected item and a standard grey box for the rest. up to now, all that gets shown is a grey box for all. We have been looking around for a solution for this but we fail to get to the bottom ...

Asking for good ASP.NET MVC 2 resources

Hi, since it's trivial that Rails crawls on Windows, I'm going to try and play with MS's ASP.NET MVC 2, any recommendation for the resources that I should be reading (ebooks/books are preferred, but tutorial websites are fine too) ? By the way my programming skills is beginner - intermediate. Thanks a lot guys. ...

Ajax.BeginForm + Updating entire page in IE9

I'm using MVC2 and have a telerik popup window in which I'm doing a search and wanting to display the search results in a second tab. I have my search form in the first tab, on post, I perform the search and have a partialview containing a telerik grid. This works perfectly in Chrome, but when I give it a go in IE9, it shows the search...

Bypass Client Side Validation when using Ajax.BeginForm

When using Html.BeginForm("SaveAction") and Html.EnableClientValidation() you can bypass client side validation using <script type="text/javascript"> document.getElementById("mySaveButtonId").disableValidation = true; </script> Does anyone know how to achieve similar results with Ajax.BeginForm("SaveAction", new AjaxOptions()) ...

Mono MVC 2 home route doesn't work

I'm trying to convert an ASP .NET MVC 2 app to run on nginx/mono 2.8. So far it seems to work quite well except that the default route doesn't work when the path is empty. I am proxying all requests through to the fastcgi server and I get served up with an ASP .NET 404 not found page. i.e. This doesn't work http://mysite.com But this...

ASP.Net MVC 2.0 : Absolute action URL using HttpRuntime only (no HttpContext)

I need to build a URL for self-ping action. I want to initialize that URL from Application_Start, which doesn't have HttpContext (on ISS 7.0 integrated mode). I have code to build absolute Action URL using HttpContext, now I need the same but use HttpRuntime instead. ...

Best practices for authorization for UI elements

I'm creating an app that's using Active Directory groups for authentication. What are the best practices for controlling authorization of UI elements (links, content, images, etc)? For example, I have some links that only certain groups can access. I understand using Authorize attribute to control which groups can access a given Actio...

Managaing Jquery custom events

I've done a few hours of additional research but I still can't find a good pattern to what I would think is a common problem. I'm working on a .Net MVC2 app. Our app is made up of a main page then a number of partial views (included pages) each one of the partial views corresponds to a widget consisting of an HTML structure and JS-jQur...

aspmvc2 render partialview with jquery using spark engine

I'm trying to return a partial view in asp mvc2 rendered with spark. The view contains some javascript. Everything gets rendered but the script does not execute here is the code <table> <tr> <td> !{Html.LabelFor(model => model.SourceId, new { @class = "label-inline", title = "Source d'ouvrage" })} !{Html.DropDownList("SourceLi...

MVC2, ajax, javascript call does not be worked out?!

Another stupid newbie question What I have: My Index site <% if (Model.Data != null) { if (Model.Data.Rows.Count > 0) { var divLoadGif = string.Empty; var divRealData = string.Empty; for(int n = 0; n < Model.Data.Rows; n++) { divLoadGif = "divLoadGif_" + n.ToS...

Storing/Calling Repeating Code blocks in MVC

Hey all, Sorry its me again. This time I have a question that I think is fairly general. I am using code that is almost exactly the same over and over again within a controller to set up a viewModel. My question was, is there a way to store this code somewhere within the MVC project, possibly have it return a viewModel, and call it...