asp.net-mvc

displaying image from Database using ajax

I was just wondering if it possible to make an ajax request from a view to an action which injects image data directly in to an image tag. To give more details, i am borrowing some code in stackoverflow. Controller; public FileResult GetImage(int id) { return File(PhotoHelper.GetImageBytes(id), "image/jpeg"); } View: <%= Html.Im...

Live, shared hosted, ASP.NET MVC site migration to Windows Azure

I have an existing ASP.NET MVC based website. Very typical: XHTML, CSS, jQuery, C#, LINQ2Sql. Web.config tells app where to connect for SQL database. Are typical websites like this easy to port to Windows Azure? What sort of headaches should I be ready for if I decided to do this? It's not necessary at this time, but I'm planning for w...

System.Windows.Media in ASP.NET MVC

Can I use the " System.Windows.Media" in the ASP.NET MVC application. Because I need to draw image using this. Is it possible or we need to use System.Drawing only for the Web Application ? ...

db4o mvc index page to detail page

Hi, in a MVC application it is quite common to have a list of objects that you click to see detail and / or edit. When using a relational db, this is achieved by using the primary key or id: <%= Html.ActionLink(dinner.Title, "Details", new { id=dinner.DinnerID }) %> How would you do this using an oodb such as db4o? Thanks! ...

Changing validationsummary-text from resourcefile

Hello I was wondering if you guys know howto get the validationsummary "title" from resouce-file? got this atm: Html.ValidationSummary("Information missing.") For my validation I use stuff like: [Required(ErrorMessageResourceType=typeof(Resources), ErrorMessageResourceName="UsernameRequired")] public object Username { get; set; } ...

Multi-page wizard in MVC - where to store the entered data

Hello. What do you think it's the best way to create a wizard over several pages in asp.net-mvc ? I am thinking to: create a hidden field in every page which contain my whole object serialized override OnActionExecuting -> get my object from the hidden or tempdata override OnResultExecuted -> put the object in tempdata, when i go to t...

asp.net MVC: Making an Xdocument available to jquery?

Hi there, Can anyone help, I have got an Xdocument which opens an XML files on the disk and returns it to the view in asp.net mvc... Everything is working ok. The problem being is that i need to manipulate the data with jquery, how do i pass this data which is asp.net mvc to jquery? here is what i have XDocument xdoc = XDocument.Lo...

how to step into system.web.mvc

Hi, Please don't focus on the examples, I have a bad habit of using examples to clarify my questions resulting in people answering my examples not my questions. The Question: Does anyone have know how I can step into system.web.mvc? The Background (you can skip this to avoid confusion): A couple of weeks ago I had a problem where MVC ...

ASP.NET MVC and role caching?

Hello, I am developing an ASP.NET MVC app with custom membership and role providers. My custom role provider uses LinqToEntities to query the user/role mapping table and retrieve if a user is in a role or not. When running on debug, local machine, everything is fine. When deploying on IIS7 however, I have this strange behavior: When I...

ASP.NET MVC Areas Application Using Multiple Projects

Hi I have been following this tutorial: http://msdn.microsoft.com/en-us/library/ee307987(VS.100).aspx#registering_routes_in_account_and_store_areas and have an application (a bit more complex) like this set up. All the areas are working fine, however I have noticed that if I change the project name of the Accounts project to say Areas...

Do I have to reassign a partial view's data back to the model when POSTing back to my controller?

Newbie ASP.NET MVC question: I have the following model: public class Customer { public string FirstName { get; set; } public string LastName { get; set; } public Address Address { get; set; } } And the following view for customer: <% using (Html.BeginForm()) { %> First Name: <%=Html.TextBox("FirstName") %> Last Name: <%=Html.T...

ASP.Net - MVC and Moq

I'm starting to build up Unit Tests for a project we have. We've decided upon Moq to assist with the 'Mocking' of the repositorys as we dont want to run the tests against the live DB. I'm obviously using Moq incorrectly, How would one write the GetMessage Test? The first 2 seem to work fine. The return value of the GetMessage Test is ...

Cassini much slower than IIS for MVC RenderPartial

I have an MVC view with a partial view recursive call that displays hierarchical data. The complete tree typically includes in the order of 500 or so items. The data is all included in the model, and the model's a trivial record class - nothing in it except auto-properties. In IIS this works fine. However in Cassini/WebDev (Visual S...

How do I stop a button event from posting in ASP.NET MVC?

I have a standard view and some standard input tags without runat=server: <button id="submit">submit</button> <button id="clear">clear</button> Pressing either causes the page to submit. Instead, I want them to do nothing since I'm handling the click event with JQuery. How do I do this? EDIT Here is my jquery code $('#submit').bind...

How to filter form data with custom model binder

I have a bunch of forms where currency values are entered and I want them to be able to enter "$1,234.56". By default, the model binders won't parse that into a decimal. What I am thinking of doing is creating a custom model binder the inherits DefaultModelBinder, override the BindProperty method, check if the property descriptor type i...

Asp.net mvc 2 - Error redirecting from ActionFilter?

What changed from mvc1 and mvc2? I have the following code that redirects to a login page if the user has not been authenticated. This doesn't work with mvc2 and results in "System.Web.HttpException: Cannot redirect after HTTP headers have been sent" public class RequiresAuthenticationAttribute : FilterAttribute, IAuthorizationFilter ...

MVC Installation taking ~Forever

I went to this page and clicked on the "Install the ASP.NET MVC Framework using the Web Platform Installer" link and proceeded with the installation. The only option I selected was to install the Web Deployment Tool and now I am staring at the following screen for the last 2 hours with no updates to the progress bar screen image I assu...

How to best map database-aware entity types between application layers

I have an ASP.NET MVC app with a primitive repository layer that currently serves LINQ to SQL entities back to the controllers which then send them to the views. I now want to start using some domain-centric objects in place of my LINQ to SQL entities, and I have been using AutoMapper to help accomplish some of this. For simple propert...

Setting the Content Type of a ViewResult

I am trying to create an ActionResult that behaves in exactly the same manner as a ViewResult but allows me to specify the Content-Type header. This is difficult because from what I can tell ASP.Net MVC hands off to the webforms rendering engine, which then sets the content type using the header on the page, this method isn't viable for ...

DropDownListFor in EditorTemplate not selecting value

Hi, I have an editor template for a custom object. Inside that editor template I use a couple of DropDownListFor helpers. In each of them I specify a unique model property (with the pre-selected value) and the select list containing all the select options. Example: <%=Html.DropDownListFor(m => m.DocumentCategoryType, Model.DocumentCat...