asp.net-mvc

Customizing asp.net webforms markup

I'm a new comer to the asp.net world. I hear a lot about asp.net mvc and it's advantage over webforms about the ability to customize the markup and css. I also heard that asp.net is much easier to learn than asp.net mvc so I decided to go for asp.net and webforms. My question is: what's the level of customization a web developer/designer...

IIS Express defaulting to port 44300 for https when enabling SSL

Hi there, When you initially set up IIS Express to enable SSL, it defaults the port to 44300. Unfortunately, when I try to access my site in on https://localhost/ it doesn't not working unless I use the port number 44300 - https://localhost:44300/. The links are generated using the following: <%= Html.ActionLink("Index", "Index", "Hom...

About MVC 2 View mapping mechanism

Hello everyone I wonder mapping mechanism from controllers to views. I can not understand how mapping can be possible If we just return value of View() method. Controller class's View() method call overloaded View method with null parameters. But how can be possible to mapping to views with none specified returning value of View() metho...

Modifying view location for partial views in ASP.NET MVC

I would like to have both these views: ~/Views/Customer/Index.aspx ~/Views/Customer/Index.ascx I would like to setup my MVC website so that when I call return View(viewModel) from the CustomerController.Index() action method, that it looks up the aspx file, but if I call return PartialView(viewModel) that it looks up the ascx file. ...

What is the preferred solution to dealing with dozens of route mappings in Global.asax

I was reading the following answer about regions on the topic of programming standards: http://programmers.stackexchange.com/questions/1338/worst-coding-standard-youve-ever-had-to-follow/1937#1937 I tend to agree with what @Cumbayah is saying, but I have to admit that there's one place where I'm relying on regions to keep the code tidy...

ASP.NET MVC2 master page and authentication

Update: I can't delete this question, because the answer has been upvoted, yet it is not at all the answer to what I'm asking. I'd like to delete this, as it has been a week with no answer, and it's just dragging down my accept %. Thanks. I have a strongly typed master page that includes information that is based on the currently aut...

Custom ModelBinder for IEnumerable post result in MVC

Consider this view model that uses two custom validators. It posts back to the controller in an enumerable collection. public class FormFieldViewModel { public Guid FormFieldKey { get; set; } public string Name { get; set; } // Utilize a string[] array since multiple-selection items will require this (we can assume array[0]...

Return Razor partial view using JSON (ASP MVC 3)

In MVC 2 with the regular view engine i could return a ascx partial view as string through return Json() But with the new Razor .cshtml views I can not figure out how to do this. I keep getting Type 'ASP.CustomerForm_cshtml' does not inherit from 'System.Web.UI.UserControl'. The partial view inherits from System.Web.Mvc.WebViewPage<T> ...

ASP MVC DateTime problem model validation problem

I have MS SQL in my local development server and production server. The DateTime format of my local server is "mm/dd/yyyy" but the format in production server is "dd/mm/yyyy". Every thing worked fine in my local server , but when I try to enter a date like "05/31/2010" in my production server, the Model Validation threw an error "The va...

Enable client validation in Razor views (ASP MVC 3)

I try to add client side validation using this line of code: @Html.EnableClientValidation() But I keep getting this error message: Compiler Error Message: CS1502: The best overloaded method match for 'Microsoft.WebPages.WebPageUltimateBase.Write(Microsoft.WebPages.Helpers.HelperResult)' has some invalid arguments Is this working for ...

Slow Nested RenderPartial Response times - MVC

Hi I have an asp.net view/page (dynamic) that is built up of nested Html.RenderPartials. The view is sent an appropriate viewmodel to render. Firebug says the GET response for the HTML is 9.89 secs for 9.5KB. To compare the FAQ page (static html) of the same site is 1.3 secs for 17K. At first I thought it was the SQL Entity back en...

Razor syntax inside attributes of html elements (ASP MVC 3)

I have a table with repeating customer rows, I would like to add the customer ID to the ID attribute of my table rows like this: <tr id="row<customer id>"></tr> I try adding this code: @foreach(var c in Model) { <tr id="[email protected]"></tr> } Which gives me the following output: <tr id="[email protected]"></tr> <tr id="[email protected]"></tr> etc....

Asp.Net MVC IgnoreRoute inside an Area

How to ignore a route inside an area? I have captcha in my MVC application.It loads its image from an GenericHanlder(.ashx),so if imnot using areas it works fine, if I just ignore routes from that URL. i.e: In Global.asax routes.IgnoreRoute(Counts/{filename}.{ashx}/{*pathinfo});//Counts is the controller name without an area The pro...

ASP.NET MVC Controller Factory life cycle

The DefaultControllerFactory contains three different methods: GetControllerInstance CreateController GetControllerType When is each method executed in the request lifetime? I've seen custom controller factories where one of these methods is overridden and implemented but I can't seem to find details on the execution path of each one...

WCF and ASP.NET MVC: Service Too Busy

I've got a WPF application that does a very simple image playlist. It needs to be controlled by a web browser, so I opted for ASP.NET MVC, being familiar with it. If I publish and install the WPF app to my local computer, and run the MVC web app through VS2010 locally, it works perfect. I can control the WPF app via a web browser. ...

MVC 3 Preview 1 with Azure Development Environment

I am in the early stages of developing an Azure web project which will likely take more than six months to complete. The views which make up the UI would benefit from clean syntax provided by the Razor view engine found in the MVC 3 preview 1. The following exception is thrown whenever the site is run as an Azure web role: InvalidOpe...

EF model already sets up validation on entity properties?

I've just ran into an unexpected behaviour for Entity framework entities in use with ASP.NET MVC application with SQL Server as datastore. For a column marked as not null allowed I did not set up data annotation Required attribute inside the entities' metadata partial class (I was under impression that I had to for all properties that I ...

Need help debugging XHR-based Ajax Image Upload with ASP.NET MVC2

I'm attempting to use the script found from http://valums.com/ajax-upload/ My controller is as follows using System; using System.IO; using System.Text.RegularExpressions; using System.Web; using System.Web.Hosting; using System.Web.Mvc; using MHNHub.Areas.ViewModels; using MHNHub.Models; using MHNHub.ViewModels; namespace MHNHub.Area...

Whats better design/practice: Nullable property or 1 value property and 1 bool "has" property?

I'm working on an ASP.NET MVC app, designing the domain models, using (testing) the new EF Code First feature. I have an Activity entity that may or may not have a Deadline, what is the best way to approach it? 1 property: public DateTime? Deadline {get; set;} and check vs null before using or 2 properties: public DateTime Deadl...

asp.net mvc database model dynamic Properties

Hi All, Im just wondering how you go about creating dynamic properties on entities that generated from a database generated model. For example I have a UserInformation table. In that table it has basic information on the user (well derr) like user name, address details etc etc. I want to add a readonly property that concatenates the use...