asp.net-mvc-2

What exactly is improved in MVC3 pertaining to validation?

时光总嘲笑我的痴心妄想 提交于 2019-12-31 05:36:07
问题 In asp.net-mvc-3 - Improved model validation with unobtrusive JavaScript and jQuery support. I think, unobtrusive-validation is already present in asp.net-mvc-2 Question : What exactly is improved in MVC3 pertaining to client validation? 回答1: I think, unobtrusive-validation is already present in asp.net-mvc-2 Ah no, it wasn't. Question : What exactly is improved in MVC3 pertaining to client validation? The Ajax.* helpers are now using HTML5 data-* attributes which are interpreted by the

Removing master layout from view (MVC2)

人盡茶涼 提交于 2019-12-31 04:41:07
问题 if i need remove master layout from my view, how can i do it in MVC2? i tried put code in my view that was shown in documentation http://sparkviewengine.com/documentation/master-layouts: , but it still bring my Application.spark layout :-/ any ideas why? 回答1: Not tested, but what if you create and empty master layout, and say <use master="EmptyMaster" /> in the top of your view? Or you could call on the empty master from the controller; return View("View", "EmptyMaster"); Don't know if it'll

ASP.NET MVC Custom Routing Long Custom Route not Clicking in my Head

不羁的心 提交于 2019-12-31 02:10:15
问题 I have spent several hours today reading up on doing Custom Routing in ASP.NET MVC. I can understand how to do any type of custom route if it expands from or is similar/smaller than the Default Route. However, I am trying figure out how to do a route similar to: /Language/{LanguageID}/Question/{QuestionID}/ And what I would like, too, is similar to how SO works. Something like: /Language/{LanguageID}/Arabic/Question/{QuestionID}/Some-Question-Title Where "Arabic" and "Some-Question-Title" can

Too many JavaScript and CSS files on my ASP.NET MVC 2 Master Page?

喜欢而已 提交于 2019-12-30 11:41:29
问题 I'm using an EditorTemplate DateTime.ascx in my ASP.NET MVC 2 project. <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DateTime>" %> <%: Html.TextBox(String.Empty, Model.ToString("M/dd/yyyy h:mm tt")) %> <script type="text/javascript"> $(function () { $('#<%: ViewData.TemplateInfo.GetFullHtmlFieldId(String.Empty) %>').AnyTime_picker({ format: "%c/%d/%Y %l:%i %p" }); }); </script> This uses the Any+Time™ JavaScript library for jQuery by Andrew M. Andrews III. I've added

Shouldn't MVC ignore images by default?

别说谁变了你拦得住时间么 提交于 2019-12-30 10:52:50
问题 If there is 1.jpg image, so it is downloaded and showed <img src="Content/Pages/1.jpg" /> But, if there is no 1.jpg image in Pages folder, so I get the following error The controller for path '/Content/Pages/1.jpg' could not be found or it does not implement IController. I fixed it by registering route to IgnoreRoute , but shouldn't it ignore images by default? routes.IgnoreRoute("Content/{*pathInfo}"); 回答1: That's actually handled by your hosting environment/web server, not by MVC per-se. I

Shouldn't MVC ignore images by default?

拟墨画扇 提交于 2019-12-30 10:52:35
问题 If there is 1.jpg image, so it is downloaded and showed <img src="Content/Pages/1.jpg" /> But, if there is no 1.jpg image in Pages folder, so I get the following error The controller for path '/Content/Pages/1.jpg' could not be found or it does not implement IController. I fixed it by registering route to IgnoreRoute , but shouldn't it ignore images by default? routes.IgnoreRoute("Content/{*pathInfo}"); 回答1: That's actually handled by your hosting environment/web server, not by MVC per-se. I

Get Areas associated with an MVC project

99封情书 提交于 2019-12-30 09:24:12
问题 Is there a way I can get the names of the areas in an MVC project? Here's a few ways I can think of: a) If I had the source, I could browse through the project folder structure and enumerate the folders under the Areas folder. But that wouldn't guarantee all the folders represent areas unless I also enumerated the Controllers and Views folder under each of the sub-folders. This approach, as you can tell, sucks. b) From the binary, I could enumerate all namespaces that match the criteria

Get Areas associated with an MVC project

别等时光非礼了梦想. 提交于 2019-12-30 09:24:10
问题 Is there a way I can get the names of the areas in an MVC project? Here's a few ways I can think of: a) If I had the source, I could browse through the project folder structure and enumerate the folders under the Areas folder. But that wouldn't guarantee all the folders represent areas unless I also enumerated the Controllers and Views folder under each of the sub-folders. This approach, as you can tell, sucks. b) From the binary, I could enumerate all namespaces that match the criteria

Hide editor-label for public property when calling EditorFor(…)?

你离开我真会死。 提交于 2019-12-30 09:06:14
问题 When calling Html.EditorFor(m => m) , where m is a public class with public properties, a hidden input and a label are displayed for properties with the [HiddenInput] attribute. How can I hide the label without making it private or creating an editor template? Example public class User { [HiddenInput] public Guid ID { get; set; } // should not be displayed in editor template public string Name { get; set; } // should be editable } Undesired result for ID property by EditorFor(...) with label

How to set ID and Text in html.label helper in mvc2

纵饮孤独 提交于 2019-12-30 08:25:53
问题 I want to set ID and Text attribute in html.label helper in mvc2 <%:html.label<have to set ID and Text properties here>%> Plz help me out.. 回答1: The Html.Label method returns an HTML label element and the property name of the property that is represented by the specified expression. For example: ASPX Syntax <%: Html.Label("Text Content", new { id = "labelId" })%> Razor Syntax @Html.Label("Text Content", new { id = "labelId" }) The second parameter is the htmlAttributes, so, you can add any