asp.net-mvc-2

Can I use MVC validation attributes within a custom model binder?

I have lots of MVC validation attributes on my model. Everything works great when the defaultModelBinder binds my model on submit. But, I need to create a custom modelbinder. I'd like to continue using my validation attributes. Can I? If so, how? ...

Custom Model Binder, asp.net mvc 2 rtm 2, Parsing ID to ComplexModel

I have found myself with at little problem, and I think a custom model binder is the way to go. My Domain model looks like this,readly standard I got a Page and a Template. The Page has the Template as a ref. So the Default asp.net mvc Binder, does not know how to bind it, therefore I need to make some rules for it. (Custom Model Binde...

App_Browsers ignored

I'm using Mobile Device Browser File ( http://mdbf.codeplex.com/ ) for my ASP.NET MVC 2 application. Locally, with VS 2010 web server, everything works fine : I use Firefox with User Agent Switcher, and it is detected as a mobile device. However, when I upload the application to my hosting provider, it isn't working anymore. As it is...

Logout exception flooding elmah

I am using ASP.NET membership, and in particular a copy of the membership code included in the MVC project. I am also using elmah to log exceptions. I am getting flooded with the following when people sign out. System.Web.HttpException: Server cannot set status after HTTP headers have been sent. Here is the stack trace sent System.We...

Newbie question about controllers in ASP.Net MVC.

I'm following a tutorial on creating the NerdDinner using ASP.Net MVC. However, I'm using Visual Studio 2010 Ultimate edition and there was only MVC2 to choose from. So I've following the tutorial so far, and everything is really clicking and being really well explained, until this little hitch. The guide is asking me to create new met...

asp.net mvc making delete usercontrol information passing on and off

i am creating a generalize deleteusercontrol , my aim is that on the listing page where all the records are listed when the delete is pressed i want to display the acknowledgment on the same page up the list. I had little idea to do that q1) first of all where will i place my deleteusercontrol(in the shared folder?). q2) on and off th...

Anyone have any issues with using PLINQO and ASP.NET MVC 2.0?

I'm asking because I'm working on an ASP.NET MVC 1.0 site, thinking of upgrading to ASP.NET MVC 2.0. Then I read that PLINQO 5.0 was released (I had never heard of PLINQO before) and have been impressed with what PLINQO appears to be capable of. 1) Is PLINQO capable of building out an ASP.NET MVC 2.0 UI project when it's run? 2) Have y...

setfocus on the msg display

ok the thing is that when i click delete on the view list page i want to set focus on the acknowledgment displayed there . delete is a ajax link . how would i do that? ...

Data Annotations on ViewModels or Domain Objects

Where would data annotations be more suitable: ViewModels or Domain Objects or Both I am struggling to decide where these will be more suited. I have not as yet fully utilized them but this question came to mind. From most of the examples I have seen, they are generally placed on Models and simply use the required attributes for va...

result set using two different views (from an if statement)

Hi All, I have a bit of code that works with a result set called "result" (original I know) but depending on the incoming variable I'd like to fire the specific query depending. I have the below in an if statement but that just makes the "result" recordset gets those nasty red lines and it doesn't work. I'm sure this is easy to work out...

ASP. NET MVC2: Where abouts do I set Current.User from a Session variable?

Hi, I'm trying to get authentication and authorisation working in an ASP .NET MVC2 site. I've read loads of tutorials and some books which explain how you can use attributes to require authorisation (and membership in a role) like this: [Authorize(Roles="Admin")] public ActionResult Index() { return View(); } I've made classes t...

asp.net mvc calling child record in the view

ok i have the view in which there is a list. every record in the list have some child records . when i click on the details link . i want the records to be displayed in the table below. what mechanism i should follow. i want some way to trigger the table below? ...

asp.net mvc2 - update list of objects

I want to display list of objects from database, and on the same page have option to edit them. When submitting, I'd like to submit changes to all of them. I found this link: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx and http://www.hanselman.com/blog/ASPNETWireFormatForModelBindingToArraysListsCollectionsDictiona...

MVC model binding to interfaces

I have created an OrderFormViewModel which looks something like public class OrderFormViewModel { public IOrderDetails { get; set; } public IDeliveryDetails { get; set; } public IPaymentDetails { get; set; } // ... etc public SelectList DropDownOptions { get; set; } // ... etc } This goes to my Create view, ...

showing errors from actions in table-based views

I have a view where I want to perform different actions on the items in each row in a table, similar to this (in, say, ~/Views/Thing/Manage.aspx): <table> <% foreach (thing in Model) { %> <tr> <td><%: thing.x %></td> <td> <% using (Html.BeginForm("SetEnabled", "Thing")) { %> <%: Html.Hidden("x", thin...

How to publish an ASP.NET MVC website

Hello -- I've a site that I'd like to publish to a co-located live server. I'm finding this simple task quite hard. My problems begin with the Web Deploy tool (1.1) giving me a 401 Unauthorized as the adminstrator because port :8172 comes up in the errors and this port is blocked - but the documentation says "The default ListenURL is h...

How do you get the nonce value in an MVC.NET App?

In the research that I have done there is an oAuth library out there, but I guess this isn't in System.Web or System.Web.MVC etc. If using the nonce value is the correct way to prevent relay attacks and the preferred method to prevent duplicate form submissions it would seem like there would be an out of box solution to get at this value...

How to pass strongly typed results back to ActionResult?

I have a view that is strongly typed: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MPKwithMVC.Models.SmartFormViewModel>" %> Works great to generate the view, but when I post, I have an ActionResult defined: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Next(MPKw...

Asp.net mvc route drops numeric folder at the end of a wildcard

So we have a route setup that has a wildcard at the end to capture a file path, the route might look like: /{browserName}/{browserVersion}/{locale}/{*packageName} The problem comes in when we try a path like: /FF/3/en-US/scripts/packages/6/super.js What ends up getting passed to the controller as packageName is: /scripts/packages/su...

How to pass data between pages without sessions in ASP.net MVC

Hello All: I have one application in which I want to pass data between Pages (Views) without sessions. Actually I want to apply some settings to all the pages using query string. For example if my link is like "http://example.com?data=test1", then I want to append this query string to all the link there after and if there is no query s...