asp.net-mvc-2

Guidance on a better way to retain filtering options when using ASP.NET MVC 2

别等时光非礼了梦想. 提交于 2019-12-18 09:17:12
问题 I have an ASP.NET MVC 2 application which in part allows a user to filter data and view that data in a JQGrid. Currently this consists of a controller which initialises my filter model and configures how I wish my grid to be displayed. This information is used by a view and a partial view to display the filter and the grid shell. I use an editor template to display my filter. The JQGrid makes use of a JsonResult controller action (GET) to retrieve the results of the filter (with the addition

ASP.Net MVC 2 Model Validation Regex Validator fails

谁说胖子不能爱 提交于 2019-12-18 09:06:57
问题 I have following property in my Model Metadata class: [Required(ErrorMessage = "Spent On is required")] [RegularExpression(@"[0-1][0-9]/[0-3][0-9]/20[12][0-9]", ErrorMessage = "Please enter date in mm/dd/yyyy format")] [DataType(DataType.Date)] [DisplayName("Spent On")] public DateTime SpentOn { get; set; } But whenever I call ModelState.IsValid it always returns false because regex is not validating. I have matched the entered date (08/29/2010) against new regex using same pattern and it

ASP.Net MVC 2 Model Validation Regex Validator fails

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 09:06:26
问题 I have following property in my Model Metadata class: [Required(ErrorMessage = "Spent On is required")] [RegularExpression(@"[0-1][0-9]/[0-3][0-9]/20[12][0-9]", ErrorMessage = "Please enter date in mm/dd/yyyy format")] [DataType(DataType.Date)] [DisplayName("Spent On")] public DateTime SpentOn { get; set; } But whenever I call ModelState.IsValid it always returns false because regex is not validating. I have matched the entered date (08/29/2010) against new regex using same pattern and it

How to change [DisplayName“xxx”] in Controller?

99封情书 提交于 2019-12-18 08:55:49
问题 Folks, I am MVC 2 newbie and stuck on this problem: AccountModuls.cs public class LogOnModel { [Required] [DisplayName("User name")] public string UserName { get; set; } … } LogOn.aspx <%: Html.LabelFor(m => m.UserName) %> The text “User name” will be finally displayed in the website - based on my definition [DisplayName("User name")]. No Problem. But how can I change this text in AccountController.cs? public ActionResult LogOn() { return View(); } 回答1: You can't :) You have to change the

Remove search operator (AND/OR) in multiplesearch jqGrid

你说的曾经没有我的故事 提交于 2019-12-18 08:54:58
问题 I need to hide the operator in the search popup, but I cannot get it to work. I tried this, but both operators still appear: jQuery("#grilla").navGrid("#paginador", {del:false,add:false,edit:false},{},{},{},{ groupOps: [{ op: "OR", text: "any" }], multipleSearch:true}); Any ideas? Thanks! 回答1: There are no option which can directly do what you need. Moreover if you would hide the ADD/OR operand from the searching dialog at the dialog initialization (for example inside of beforeShowSearch

How to remove flashing on persisting remotely populated jqgrid tree node

十年热恋 提交于 2019-12-18 07:15:19
问题 jqGrid tree nodes are read from server using json data. Click in node reads child nodes from server. Code below is used to restore opened tree node if page is loaded. Only single node is opened always in tree. Controller assings node ids to autoClicked array and gridComplete opens nodes using this path. This causes grid flasinging on page load since multiple server requests buid grid multiple times. How to disable grid flashing ? Is it possible to prevent multiple jqGrid building and show

How can we load multiple partial views on single view between specific time period?

断了今生、忘了曾经 提交于 2019-12-18 07:09:21
问题 I have multiple partial view on my single view page. Partial views load dynamically. And I want partial views load 1 by 1. Is it possible to do so? 回答1: In you View, keep three Divs and assign the Url details in some attribute like below. Sample HTML <div id="Div1" attr-Url="@Url.Action("ActionName", "ControllerName", new { area = "Area Name" })"> </div> <div id="Div2" attr-Url="@Url.Action("ActionName", "ControllerName", new { area = "Area Name" })"> </div> <div id="Div3" attr-Url="@Url

Custom Delete Function in jqGrid

℡╲_俬逩灬. 提交于 2019-12-18 07:05:15
问题 I am trying to customize the delete function in jqGrid. I have enabled the delete button on the grid $("#myGrid").jqGrid('navGrid', '#pager', { add: true, addtitle: 'Add Customer', edit: true, edittitle: 'Edit Customer', del: true, deltitle: 'Delete Customer', refresh: true, refreshtitle: 'Refresh data', search: true, searchtitle: 'Apply filters', addfunc: addForo, editfunc: editForo, cloneToTop: true }, {}, // default settings for edit {}, // default settings for add {}, // default settings

Export html table to excel in asp.net MVC2

假如想象 提交于 2019-12-18 05:14:13
问题 Hi am looking for the best way on how export to excel does in ASP.NET MVC Now i got this one from billsternberger.net Export to Excel or CSV from ASP.NET MVC with C# //Export to excel public ActionResult Download() { List<Lookup> lookupList = data,GetLookupList(); var grid = new System.Web.UI.WebControls.GridView(); grid.DataSource = lookupList; grid.DataBind(); Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=YourFileName.xlsx"); Response.ContentType =

Possible to use ASPNET MVC2 without IIS?

醉酒当歌 提交于 2019-12-18 05:10:46
问题 I know of the ServiceHost class, that lets me write a custom host for a WCF service. This means there's no requirement for IIS. (I also know all the advantages of using IIS - no need to rehash those for me.). Is there something similar to allow me to host ASPNET MVC2, without IIS? Conversely, Is IIS a hard requirement for ASPNET MVC2? Has anyone used UltlDev Cassini, and if so, what are your experiences? Will it run ASPNET MVC2? (I am using .NET 3.5) 回答1: You can run it on Cassini, Mono, IIS