asp.net-mvc

Unable to host WCF service correctly in IIS7

I have a WCF Service library written in .NET 4.0. I have a WCF application (in order to host this service in IIS) within the same solution. It contains the WCF library assembly reference and a service.svc file pointing to the service from the library along with a web.config that is a replica of the WCF service library's app.config. The W...

Building a complex page in asp.net MVC

Hi Guys, I am currently considering the best way of building a relatively complex page in asp.net mvc. The page (and pages like it) will contain numerous 'controls' such as a shopping basket, recent news widget, login controls and more. In other words, it will be very component based. My question is, what is the best way of building som...

bind drop down?

in the aspx page i am getting this error while binding dropdown list Unable to cast object of type 'System.Web.Mvc.SelectList' to type 'System.Collections.Generic.IList`1[System.Web.Mvc.SelectListItem]'. I have written: <p> <label for="categoryId">Category:</label> <%= Html.DropDownList("categoryId", (IList<SelectListItem>...

Asp.Net MVC - Areas

I'm looking at Haacks article here - http://haacked.com/archive/2009/07/31/single-project-areas.aspx When I download the sample I get the following errors in the Global.ascx Error 1 'System.Web.Routing.RouteCollection' does not contain a definition for 'MapAreaRoute' and no extension method 'MapAreaRoute' accepting a first a...

Ugly URLs when an ASP .NET MVC app is hosted in a virtual directory

I am using Godaddy Deluxe hosting which allows me to host several websites in a single hosting account. The main website is hosted in the root of the hosting account and the rest of the websites are hosted in a subfolder in the form /hosting/websitename. If I deploy an MVC app under a virtual directory, I get ugly looking URLs like: ...

Asp.net mvc send parameter to action with submit button in the partialView

My partialView is Opened in the modal dialog form, User select special row, I want to Submit the parent form with special value as a parameter. My parent form is: <form id="mainForm" action="<%= Request.RawUrl %>" method="post" enctype="multipart/form-data"> and my submit button in the modal dialog (and in the GridView) that post dat...

Incorrect characters at ModelBinding

Hi, i have a problem i am developing an asp.net mvc project. Website is in Turkish Language. When i publish this website to IIS Turkish characters get crazy in web pages so i set globalization in my web.config as <globalization fileEncoding="iso-8859-9" requestEncoding="iso-8859-9" responseEncoding="iso-8859-9"/> After this Turkish ch...

POSTing data to ASP.NET MVC from a WPF app

Hi -- I'm trying to submit some Json data to an ASP.NET MVC controller from a WPF app. I wrote my client-side code based on a couple of samples from MSDN using the WebRequest object and BeginGetResponse. This worked fine when I was just sending a GET request. It hit my ASP.NET MVC controller just fine and brought back some Json data....

Rails and ASP.NET MVC when to use each?

Hi, we have a mixed development environment using ASP.NET MVC and Ruby on Rails. We have come from a purely C# / ASP.NET background, but now have some rails experience and we love both. Problem is deciding at the beginning of a project which one to use can sometimes be tricky. Any tips for how to explain to the non technical members of...

How To Upload Image

I am getting the following error whilst uploading a file. The parameters dictionary contains a null entry for parameter 'category_id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult AddProduct(Int32, System.String, Single, System.String, System.String, System.String, System.String, System.S...

Response.write in a HTML element c#

Hi, I am picking my way through some c# code I inherited, and trying to show an image within a link;this is the line that works, and show's the image, but I need to wrap this in a link. Response.Write(Html.PropImage(item.MainImage.ImageUrl095, item.AccomName)); I noticed later on there is a link element, so I thought I could copy this...

Set language to Swedish

I have this in my partial view: <tr> <% for (int currentDay = 0; currentDay < 7; currentDay++) { %> <th> <%= System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.DayNames[currentDay] %> </th> <% } %> </tr> The weekday names render correctly in Swedish, but somehow the week starts with Sunday, whil...

Project Windsor - Repository Extending DataContext

Before I begin I will say this: I have to extend DataContext in my repository because I'm calling stored procedures and ExecuteMethodCall is only available internally. Many people don't seem to know this, so please don't say "just don't extend DataContext". I've just started using Windsor as my IoC container. My controller happily doe...

FilterAttribute Order not working

I have 2 attributes that I use within the controllers of my MVC application. AttributeA extends System.Web.Mvc.AuthorizeAttribute and AttributeB extends System.Web.Mvc.ActionFilterAttribute. I want AttributeB to always be run first. I have tried all possible combinations of Order based on this article, but AttributeA is always run befor...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not have a lot of unit tests in it... The problem we are having is trying to keep each other from overwriting each others changes. For examp...

structureMap mocks stub help

I have an BLL that does validation on user input then inserts a parent(PorEO) and then inserts children(PorBoxEO). So there are two calls to the same InsertJCDC. One like this=>InsertJCDC(fakePor) and another like this=>InsertJCDC(fakeBox). When I stub out the parent I want to return fakePor. But when I run the code it returns...

How to fix the error 'System.Web.Mvc.Controller' is not defined.

I started out this morning working with my ASP.NET MVC project like normal and everything worked. I added a new class and some functions and it still worked. Then, all of a sudden, while I was working with a javascript file, I started getting these not defined errors on the MVC classes/functions. There are 118 of them in the project a...

asp.net mvc automapper parsing

let's say we have something like this public class Person { public string Name {get; set;} public Country Country {get; set;} } public class PersonViewModel { public Person Person {get; set;} public SelectList Countries {get; set;} } can automapper be used to perform to parse from Person into PersonViewModel and back ? ...

Are there any MVC 2 books in the pipeline?

I'm looking at getting an asp.net MVC book for christmas but i wanted to make sure that there isn't a book on MVC 2 just around the corner, as i can wait :) Mike ...

Create an incremental placeholder in NHaml

What I want to reach is a way to add a script and style placeholder in my master. They will include my initial site.css and jquery.js files. Each haml page or partial can then add their own required files to those placeholders. Currently I'm creating two strings in my master that I append to in my views. This results in an ugly and erro...