asp.net-mvc

HowTo: Using MvcContrib.Pagination without using MvcContrib.Grid View

This started as a question, but turned into a solution as I did some experimenting! So I thought I would share this with you all. My question WAS: How to use MvcContrib.Pagination without using MvcContrib.Grid View? My answer is below... ...

JQuery Tab using ViewModel data...

using asp.mvc & jquery (with ui.tabs): i would like to change the view model before clicking the tab (programatically) but it doesn't appear to be working. i click the tab just fine but the view model's data hasn't changed. here is how i'm doing it: first: i check to see if you are my tab. if so, i check to see if the controller h...

Problem with Json

Im having this weird problem with creating Json dynamically.... for some reason this doesnt work var jsonData = new { total = totalPages, page = page, records = totalRecords, rows = ( from company in companies select new { ...

ASP.Net MVC and Windows 7 404 error

O.K. Stupid question..... I sepnt nearly a day getting an MVC site working, and then I published it. After that, the hell began. I'm using Windows 7, Visual Studio 2008 and MVC. I published it and first the Default.aspx wouldn't come up. I gave up on playing with that for a few and just did the easy thing a typed in default.aspx. ...

ASP.NET MVC DropDownList Selected Value Problem

I have read a ton about this problem, but I cannot figure it out. I have a dropdownlist on my view that is used for paging. You choose the page you want to go to and the form gets submitted. When the view is returned, the requested page is shown. The dropdownlist changes to reflect the newly shown page. This is working fine. My problem...

Page Not Found error in ASP.NET MVC application on live server

Hello SO: I wrote a simple file upload application using ASP.NET MVC. I tested it successfully on my development machine, but when I attempt to use it on my live server any action I try results in a Page Not Found page. With my hosting provider (reliablesite.net), I needed to specifically upload the System.Web.Mvc dll to my bin folder,...

Why is my Castle Windsor controller factory's GetControllerInstance() being called with a null value?

I am using Castle Windsor to manage controller instances (among other things). My controller factory looks like this: public class WindsorControllerFactory : DefaultControllerFactory { private WindsorContainer _container; public WindsorControllerFactory() { _container = new WindsorContainer(new X...

How to run ASP.NET MVC 1 and 2 on the same machine?

I have developed a site using MVC 1, then updated to MVC 2 Preview 1 and now when I open the site I found the error: The project type is not supported by this installation. Since I want to stick this project with the version 1, but also I want to create my new projects with version 2, how can I resolve this already made project to ...

Using JQuery datepicker with an ASP.NET MVC ViewModel

Hello all, I've been trying to use a JQuery datepicker (calendar) in my asp.bet mvc view. Everything was working ok until I had to use a ViewModel: since I preferred to use the hard-coded object graph (ie <input name="viewmodel.Meeting.Date"...) instead of using a model binder I'm stuck with a script that doesn't work- apparently the JQ...

ASP.NET MVC View Issue when returning ActionResult from different Action

Hello, I have two ASP.NET MVC Actions: public ActionResult GetAll() { return GetOne(1); } public ActionResult GetOne(Int32 id) { return View(id); } As you can see, GetAll is calling the action GetOne. However, when GetAll() is called (calling GetOne(id) and should be returning GetOne view) MVC throws an error saying t...

Map path of local file ASP.NET/MVC

Hello SO: I have a file upload program written in ASP.NET MVC. It is currently on my local development machine, and I would like to know how (if it is possible) to generate a link for each uploaded file so when it is clicked, the item is displayed/downloaded etc. Current code/markup that handles displaying file list: <table> <tr> ...

S#arp Architecture model binder enumeration error

I am receiving an error from the SharpArchitecture model binder. "Collection was modified; enumeration operation may not execute." (Stack trace at the bottom). My MVC pages to create and edit my SettingsModel throw the error. This started happening when we upgraded to the release version of S#arp Architecture 1.0. My class has a fe...

Asp.net Internet explorer prompts a credential window

Hello, I just uploaded a project to my hosting, is a asp.net mvc project with authentication. Just when i enter the web internet explorer prompts a credential windows. If I cancel, the web works correctly. The web works correctly also in local using the visual studio server. More information: "Allow Anonymous Access" is checked and th...

Inline server tags in Mono ASP.NET

I have recently managed to make my ASP.NET MVC application run under Linux with the Mono runtime. The .aspx pages execute perfectly, including assignment inline server tags, eg: <%= "Some output" %>. Unfortunately, it seems that those tags for simple code execution are not treated by the server. Here is an example: <% if(some...

What are some best practices for Model validation in ASP.NET MVC?

I'm not interested in answers concerning client side validation or model binding. Really, this question could apply to any data access class library outside of MVC, but the issues are similar, I think. I'm using the Repository pattern currently for data access with my entities (models). Currently the repositories handle all of the CRU...

Is a custom role provider in ASP.Net instantiated for every user using Windows Authentication?

I've written a custom Role Provider for ASP.Net MVC. I'm calling a WCF service to get the roles to authorize the current user. I'm using Windows Authentication. I want to store the current users roles in a variable for the role provider class but am unclear if the class is created per session, or per application. ...

Edit model object doesn't bind to view as expected

I'm using ASP.NET MVC (1.0), Spark View Engine (1.0) and SubSonic (3.0.0.3). I'm having some trouble getting an "Edit" view to work correctly. So, in my controller, I have the following controller action that displays the edit form view: [AcceptVerbs(HttpVerbs.Get)] public virtual ActionResult Edit(string name) { var plot = Plot.Si...

Is possible to run ASP.NET MVC 1 with .NET 2.0.50727?

I have developed a site with ASP.NET MVC 1, and now I'm trying to deploy it to a server with .net 2.0.50727. Since it is not working, I started to think that the main error is that the server doesn't support MVC 1. Am I right? In other words, can I run ASP.NET MVC in a server with .NET 2.0.50727? ...

Caching not working right in my ASP.NET MVC website?

Hi folks, i'm trying to use OutputCaching in my ASP.NET MVC website. Problem is, when i try and change the value of one my querystring params, it's returning the data for the first item that was requested! Here's my code (with the param names changed) ... [ApiAuthorize] [HandleErrorAsJson] public class SearchController : Controller {...

using javascript and css files in ASP.Net MVC View?

Hi everyone, I'm having some trouble getting a jQuery plugin to work correctly in my MVC view. Here's what it looks like at the moment: (I've copied all needed jQuery includes and css files into the /Scripts folder of the site) <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <script src="/Scripts/jquery-...