asp.net-mvc-2

Attempting to add a strongly typed view does not find any classes in the MVC project

I have a very odd problem. Whenever I try to use the "Add View" dialog in ASP.NET MVC2 and then try to "Create a strongly-typed view" by selecting a "View data class" from the drop down of available classes none of the classes ("models") in my MVC project are showing up. The very odd part is all of the assemblies that my MVC project is ...

MVC 2 Client and Server Validation with Data Annotations - Required not working

I have a Create view which is passed a ViewModel. The ViewModel contains the following: namespace MyProject.ViewModels { public class MyObjectCreateView { public MyObject MyObject { get; set; } public List<OtherObject> OtherObjects { get; set; } } } The objects are generated using Entity Framework. I have...

Structuremap error when using HttpContextBase in constructor

I am building a ASP.NET MVC 2.0 app on .NET 4.0 and am using Structuremap 2.6.1 for IoC. I recently added a ICookie and Cookie class, the Cookie class takes HttpContextBase as a constructor parameter (See below) and now when I run my app I get this error :No Default Instance defined for PluginFamily System.Web.HttpContextBase. I have us...

How to pass multiple arguments using JQuery.Ajax in ASP.NET MVC

Hi guys i'm new to JSon and not too sure how do i pass the data around. I am using ASP.NET MVC as my development platform. In The View: $(document).ready(function() { $("select#Colors").change(function() { var photoCategory = $("#Colors > option:selected").attr("value"); // 1st parameter var userID = $(".userID").att...

MicrosoftMvcAjax.js - Is there a CDN for the MVC 2 version?

I found this link for the MicrosoftMVCAjax file for ASP.net MVC 1. Changing the url like so for version 2 yields a 404. Does anyone know what the correct URL is (if it exists)? If not - does someone know when we can expect this to be updated? ...

Creating pdf from .net mvc view

Hello Everyone, i m using asp.net mvc2 for my application. i have a view that accepts a model and renders its data in some format. i want this page to be converted into pdf file so it can be sent via attachment or created and downloaded on the fly. i have some success creating pdf with itextsharp library but they say it has very basic s...

MVC2: Non-view aspx page in iframe

I have a contradiction to deal with: I need to make a stylesheet load for a reporting object (for ASP.NET -- it requires runat), however, it won't compile when I have <% %> tags in . I need the <% %> stuff in to load stylesheets and jscripts for the rest of the page. So, I'm going to load the reporting object into an wrapped in a n...

Why does my button not show up?

Hello, I have a partial view where I render, if the user has choosen an option, a button that permit the user to generate automatically a value for a certain field. Please give a look at this picture to understand what I mean: This is achieved using the following markup on the partial view <%= Html.LabelFor( model => model.IssueCode...

ASP.NET MVC ActionLink with LinkText = absolute URL

<%: Html.ActionLink("Share Me", "Index", "Mall", new { username = Model.Username }, null)%> results as expected according to mapped routes: <a href="/Mall/Username">Share Me</a> I however need it to not say Share Me but to show the absolute URL, as well as use the absolute URL as the href: <a href="http://www.url.com/Mall/Username"...

MVC - CustomErrors does not work when setting redirectMode=“ResponseRewrite”

Hello, I have an ASP.NET 4.0 MVC web application running on IIS 6.0 with a webconfig custom error section of: <customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="/Home/Error"> <error statusCode="403" redirect="/Home/Error"/> <error statusCode="404" redirect="/Home/Error"/> </customErrors> and an error.aspx page...

Returning ad-hoc view models from ASP.NET MVC2 Controllers

Hello - I'm porting an existing system to ASP.NET MVC2. In the current legacy app, the user can select from dozens of available fields to customize CRUD forms for different entities in the domain model, similar to the way ERP systems allow customization of core modules. My question: I'm looking for a good pattern or example for this ki...

ASP.NET MVC 2 Controllers to Model Associations

In my model I have relationships like this: [Person] PersonId (PK) ... [Orders] OrderId (PK) PersonId (FK to Person.PersonId) ... A person can have multiple orders. I generated PersonController with Create/Details/List/Edit views. I want to be able to manipulate Orders also, but within the context of a Person. In other words, I...

Gracefully handling HTML tags on form submission in asp.net MVC 2

Hi I have a MVC site and will have users inputting text to be displayed on a web page. I am trying to come up with a graceful way of handling any HTML that the user try's to input - as you will probably be aware MVC 2 throws an error for any HTML in the text. I use ViewModels and decorate my properties with filters from the DataAnotatio...

Managed Fusion URL Rewriter 500 error when compiled to .NET 4.0

I'm trying to take a .net 2.0 app into the .net 4.0 world. We are leaving the webforms as is and adding new functionality in MVC2. While we could redo all of our managed fusion rewrites as mvc routes, so for the moment, I'd rather just add the new routes to MF and have it handle url rewriting duties for both webforms and controllers. ...

Convert JSON dates without timezone

I have a webservice that returns for example a DateTime object: DepartureDate. I use ajax to fetch this and in my view I convert the JSON date string to a javascript date object with this function: function convertToDate(jsonDate) { return eval("new " + jsonDate.substring(1, jsonDate.length - 1)); } The problem is that new Date() ...

ASP.NET MVC - Uploading an image to Amazon S3

Hi. I have my image from Request.Files[0]. Now, how do I upload this image to S3? I see that in the AWS .NET API you have to specify ContentBody when putting an object which is a string. How would I get the content body of my file? ...

.NET MVC website Deployment

Strange thing is happing with my .NET MVC deployment. I have tested my application on my development environment, and on IIS of my Win7 and every works as expected. But after deployed my application on Windows Server 2008, Login/Authentication page appear, on almost every pages, even to access 'scripts' and 'contents' folders. Any tip...

ASP.NET MVC 2.0 How to pass data from controller to Jquery

Hi, Iam trying to pass data from my controller, and put it into the variable in JS script. I have done it before and it worked perfectly, thats why this one puzzles me even more. Here is my code of the controller: public ActionResult GetCategories() { var categories = categoryRepository.ListActiveCategories().ToLi...

Multiple config files across libraries

My ASP.NET MVC 2 application uses Entity Framework 4.0 for the data model. Following the instructions on http://blogs.msdn.com/b/aspnetue/archive/2010/09/17/second_2d00_post.aspx I put the .edmx in its own assembly so my solution has two projects: MyApp.Core (ASP.NET MVC 2 Web Application Project, references MyApp.DataLayer) Models/ C...

How to get TinyMVC .NET class Library to work on ASP.NET MVC 2?

Hello SO, I am trying to implement the TinyMCE Spellcheck plugin that uses GoogleSpell. The thing is I am trying to install it in an MVC environment. I started by referencing the .NET class Library DLL (MoxieCode.TinyMCE) in my project. Then, I added this code to my web.config: <system.webServer> <handlers> <add name="TinyM...