asp.net-mvc-2

How can you inject an asp.net (mvc2) custom membership provider using Ninject?

OK, so I've been working on this for hours. I've found a couple of posts here, but nothing that actually resolves the problem. So, let me try it again... I have an MVC2 app using Ninject and a custom membership provider. If I try and inject the provider using the ctor, I get an error: 'No parameterless constructor defined for this ...

How to filter the dropdown list by using other dropdown list in asp.net MVC web-application

hello, everyone, I encounter a problem when I try to filter the drop down list. The situation is I wish to filter the Agent dropdown list by using the Company dropdown list in same view/form. Since I need to display the Agents that only belong to the selected Company. But I have no idea to do that. Any solution, please? ...

ASP.Net MVC 2 editor templates

Can you recommend any good open source editor/display templates (mostly editor), preferrably utilising jQuery. Like AutoComplete, datePicker, color picker, multi-select, grids, trees etc. Thanks in advance ...

Compile MvcContrib Portable Area with aspnet_compiler

Hi I have a .net mvc 2 web application. I deployed this application using aspnet_compiler and a nant build file like <target name="deploy.advance.application"> <exec program="${aspnet.compiler}" commandline='-f -u -c -p ${dir.website.advance.application} -v temp ${dir.publish.advance.application}' /> <mkdir dir="${dir.pub...

Mocking a datacontext for an object that has a dependancy

Hey everyone, I'm writing some unit tests in my project and I have a datacontext dependancy on the controller containing the methods I'd like to test. I'm using Ninject to inject the dependancy and Moq to create my mock datacontext. My DI makes use of an interface IDataContext which my dbml impliments and is used through out the inject...

Building unit tests for MVC2 AsyncControllers

Hi, I'm considering re-rewriting some of my MVC controllers to be async controllers. I have working unit tests for these controllers, but I'm trying to understand how to maintain them in an async controller environment. For example, currently I have an action like this: public ContentResult Transaction() { do stuff... return C...

Best way to implement nested loops in a view in asp.net mvc 2

Hi, Trying to implement some nested loops that are spitting out good old nested html table data. So the question is; What is the best way to loop through lists and nested lists in order to produce easily maintainable code. It can get quite narly quite fast when working with multiple nested tables or lists. Should I make use of a HTML he...

How to stop MVC caching the results of invoking and action method?

I am experiencing a problem with IE caching the results of an action method. Other articles I found were related to security and the [Authorize] attribute. This problem has nothing to do with security. This is a very simple "record a vote, grab the average, return the avg and the number of votes" method. The only slightly interest...

What is the order of execution when dealing with .NET MVC 2 Action Filters?

Say I have: [Attribute1(Order=0)] public class Controller1 { [Attribute2] [Attribute3] public ActionResult Action1() { ... } } The attributes get executed in the following order: 2, 3, 1 This makes sense because attributes 2 and 3 have an order of -1 and will be executed before attribute 1 which has an explici...

ASP.MVC parameters not passed to Action method for http post

I am trying to call Action method passing a single parameter. The method (Accepts Http Posts) is being hit when the submit button is clicked (following a dialog popped via java script for the user to confrim). However the value passed into the action method is alway null. Below is a snippet of the Page source rendered to the browser. T...

Display data tables grouped and seperated by headings on an MVC view

I'm a complete C# AND MVC noob, so this one's been a bitter struggle for me. I've done a horrible but ultimately successful job of building a website for work to display the results of the impending primary/local elections. What I need in the final view of my site is to display all the results of races in the same category. For exampl...

ASP.NET MVC 2 EnableClientValidation : validation group

I'm using ASP.NET MVC 2, DataAnnotation and MicrosoftMvcValidation.js for validation. I have two forms in my view..is there a way to use Validation Group for client side validation (like in ASP.NET Webforms). thanks ...

Open PDF Content files in ASP.NET MVC 2

I want to provide simple href links to my PDF forms that reside in my Forms folder. I have a created a simple Index.aspx and FormController Index action that simple iterates through the list of PDF files using my FormMetaData.xml file. The links get created just fine but when you click on the links I get a 404 exception. That looks li...

ASP.NET MVC2 - Isolate subfolder for using PHP

I would like to have domain.com using asp.net mvc2 technology and domain.com/blog would use php. Is it possible to do this on server and to isolate this folder to use php? I know that it is much easier with subdomain (blog.domain.com) but I'm interested in subfolder solution. ...

I have a need to give the users the ability to update a dropdown and apply that to their submission

I have an application that I am writing in ASP.NET MVC 2 following the Nerd Dinner tutorial. I am very much a beginner and was looking for examples/tutorials I could follow that would enable me to learn how to code the following scenario: A user has the option to select an option from a dropdown. If the option is not there then they ca...

Fastest Way to Clean a String to be used in a URL C# asp.net

I've been using this class for a while now to cleans data into such a form that I can use it in my URL's and I was wondering if there's a faster/better way? The order of the replacements is important as it ensures that theres no slashes at the beginning on completion and theres no double slashes in side of the text. /// <summary> /// C...

Where should I create and get the value of a Cookie which I will be using for my ASP.NET MVC Application?

EDIT : I have another problem..Now I want to get the cookies value...in controllers constructor...does not allow me to do that since HttpRequest is Null...I dont want to do it on every controller action...since want to do it only once...and then every action can access cookie value ORIGINAL : Hi all I want to create a...

MVC2 JSON input

I have a problem with a simple VS2010 .NET 4.0 MVC2 application. My controller action looks like this: public JsonResult GetJson(string query) I access the action with jQuery like so: function getJson() { var postdata = {}; postdata['query'] = $('#query').val(); $.ajax({ type: "POST", url: '<%= Url.Acti...

Routing in ASP.NET MVC 2.0

I'm looking to make a really simple route in my ASP.NET MVC 2.0 website. I've been googling for help but all the examples I can find are for really complex routing. Basically I want all the pages in my Home Controller to resolve after the domain as opposed to /Home/ For example I want http://www.MyWebsite.com/Home/LandingPage/ To bec...

ASP.NET MVC model validation error with edit scenario

I am following Scott Gu's tutorial on ASP.NET MVC 2 model validation: http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx I am using Linq To SQL so tried the buddy class technique. This works fine when using a Create scenerio as in Scott's tutorial. But when used with an edit scenerio I am getting an er...