asp.net-mvc-2

Multi step wizard form with MVC

时光毁灭记忆、已成空白 提交于 2019-12-06 06:38:07
问题 I'm planing to build a multi-step form with asp.net mvc 2. So, my web application will have 5 pages correspond to 5 steps. Each step has two submit buttons, previous and next. Input data for each step will be stored for reviewing later. For example, we already inputted data for step s 1,2,3,4 and we are in step 5 now. When I click on "previous" 2 times, step 3 should be displayed with data I inputted before. Similar, when I click "next", inputted data should also be retained in step 4 (since

Change default “The {0} field is required” (ultimate solution?)

て烟熏妆下的殇ゞ 提交于 2019-12-06 06:14:54
Good day! I've the following ViewModel class I use for login form: using System.ComponentModel.DataAnnotations; ... public class UserLogin : IDataErrorInfo { [Required] [DisplayName("Login")] public string Login { get; set; } [Required] [DisplayName("Password")] public string Password { get; set; } [DisplayName("Remember Me")] public bool RememberMe { get; set; } #region IDataErrorInfo Members // This will be a Model-level error public string Error { get { if (!WebUser.CanLogin(Login, Password)) { return Resources.ValidationErrors.InvalidLoginPassword; } else { return String.Empty; } } } //

Can I disable DataAnnotations validation on DefaultModelBinder?

随声附和 提交于 2019-12-06 06:02:52
问题 I want DefaultModelBinder not to perform any validation based on DataAnnotations metadata. I'm already using DataAnnotations with DynamicData for the admin area of my site, and I need a different set of validation rules for the MVC based front-end. I'm decorating my classes with the MetadataType attribute. If I could have different MetadataType classes for the same model but used on different scenarios that would be great. If not I'm fine with just disabling the validation on the

Sending xml to an ASP.NET MVC Action Method Argument

隐身守侯 提交于 2019-12-06 05:57:11
Is it possible to send POX (plain old xml) into an action and have that action perform model binding to an object for you. Have seen this done with JSON but dont see anyone doing this with xml. Looking at doing a similar thing, but with JSON. I think you could also use a ActionFilterAttribute for this purpose. An example is shown here . You can achieve this by creating your own model binders. you can get idea from the following links. http://odetocode.com/blogs/scott/archive/2009/04/27/6-tips-for-asp-net-mvc-model-binding.aspx http://odetocode.com/blogs/scott/archive/2009/05/05/iterating-on-an

Technique for carrying metadata to View Models with AutoMapper

◇◆丶佛笑我妖孽 提交于 2019-12-06 05:50:07
问题 I use AutoMapper to map my domain objects to my view models. I have metadata in my domain layer, that I would like to carry over to the view layer and into ModelMetadata. (This metadata is not UI logic, but provides necessary information to my views). Right now, my solution is to use a separate MetadataProvider (independently of ASP.NET MVC), and use conventions to apply the relevant metadata to the ModelMetadata object via an AssociatedMetadataProvider. The problem with this approach is that

Resource file for MVCSiteMapProvider

℡╲_俬逩灬. 提交于 2019-12-06 05:26:57
I'm using MVCSiteMapProvider for generating menus with localization for my application. My program works fine as long as the resource files for the menus are in the App_GlobalResources folder. When I move the resources into another folder, it gives an error mentioning not able to find the resources. I'm using $resources:Resource,menu_Home for accessing the resources in the MVC.sitemap file. I want to keep the resource files in a custom folder without storing them in the App_GlobalResources folder. Can anyone help? it happens because of the following code in MvcSiteMapNode.Title property: var

ASP.NET 4.0 MVC2 routing on IIS 6

柔情痞子 提交于 2019-12-06 05:21:08
ASP.NET 4.0 MVC2 routing on IIS 6 is not working for me with all the methods used for 3.5 Works fine as long as I build in 3.5 but building in 4.0 and setting the server to use 4.0 I loose my routing. Anyone seen this and been able to resolve it? tvanfosson Have you checked to make sure that ASP.NET 4.0 is allowed in the web service extensions after upgrading to .NET 4.0 on the server? See this question . 来源: https://stackoverflow.com/questions/2642403/asp-net-4-0-mvc2-routing-on-iis-6

ASP.NET MVC & Repository Pattern Understanding

末鹿安然 提交于 2019-12-06 05:06:51
问题 So I'm extremely new to ASP.NET MVC and Interface design. I've been asking a lot of questions and reading a lot of articles trying to make sense of it all. Due to a crisis at work, I have been called upon to do my best and learn this environment. And although it's been frustrating to grasp, I am slowly getting it. I have created an image in photoshop that shows my basic understanding of how the Repository Pattern works and why it's very much recommended. I'm trying to deploy this pattern at

Accessing Webservice from Asp.net MVC

雨燕双飞 提交于 2019-12-06 04:41:26
I have a MVC2 App which also includes a Non MVC part (regular Asp.Net 3.5 pages). I am calling webservice (Not WCF) from Non MVC pages to populate autocompletes. Both MVC parts and Non-MVC parts work fine in my developers machine. When i host my application in IIS, i cant access the webmethods in my webservice. I checked with firebug it returns The controller for path '/payroll/WS/MVCArch.asmx/JqUiGetEmp' was not found or does not implement IController. ' Here my virtual directory name is Payroll. and my Non MVC pages are located under a folder called "RepDocs" which is under the root of the

ASP.NET MVC 2 UpdateModel() is not updating values in memory or database

a 夏天 提交于 2019-12-06 04:37:58
I am new to MVC, and so am working through the NerdDinner tutorial, here . In particular, I'm running into problems with the use of the UpdateModel method, which is explained in the part five of that tutorial. The problem is, when I try to edit the value of a dinner object using the UpdateModel method, the values do not get updated, and no exceptions are thrown. Oddly, I am not having any trouble with the Create or Delete features that are illustrated in the tutorial. Only the update feature isn't working. Below, I have included the Controller code that I am using, as well as the view markup,