asp.net-mvc-2

ASP.Net MVC - Send Javascript Associative array to a controller

巧了我就是萌 提交于 2019-12-11 02:09:55
问题 I'm trying to pass a javascript associative array to a controller. I can pass normal arrays into a controller with this: public JsonResult ProductsByFacets(List<string> facets) but this won't work with associative arrays 回答1: Check JsonValueProvider in ASP.NET MVC 2 Futures. Sending JSON to an ASP.NET MVC Action Method Argument 来源: https://stackoverflow.com/questions/3308674/asp-net-mvc-send-javascript-associative-array-to-a-controller

UrlHelper extension method not working

爷,独闯天下 提交于 2019-12-11 02:05:33
问题 I'm trying to add an extension method to my MVC 2 project without success and after several hours of googling and looking here I'm at a loss. I've created a brand new MVC 2 project to make sure there was not anything weird about my existing project and I'm still facing the same problem. I'm sure this is a situation of I "can't see the forest for the trees" so any help would be greatly appreciated. Here is the code for the extension method. using System.Web.Mvc; namespace ExtensionTest.Helper

Asp.net ajax with mvc2

ⅰ亾dé卋堺 提交于 2019-12-11 01:55:46
问题 I am calling a ajax method as below var srchText = "Chicago"; $.ajax({ url: "/Ajax/GetCities", data: "{'srchText' : '" + srchText + "'}", dataType: "json", type: "POST", async: false, contentType: "application/json; charset=utf-8", dataFilter: function (data) { return data; }, success: function (data) { cityList = data.d; } }); The url is pointing to a MVC controller, as below, [HttpPost] public ActionResult GetCities(string srchText) { List<City> result = new List<City>(); EventsBIZ objBIZ =

scaffolding viewmodels based on database tables

纵然是瞬间 提交于 2019-12-11 01:36:59
问题 Is there anything that would aid us in designing/scaffolding View models from SQL Server database tables but would result in very lean classes? I know something like that exists for Rails, maybe there's something similar in ASP.NET MVC? I like what EF wizard creates but it's too heavy - too much attributes, constraints, events and everything is attached to the entities so you can't actually use them as View models (actually you can but it quickly becomes a pain). 回答1: I think you could use a

object Model types in MVC2 using strongly typed view pages problem

醉酒当歌 提交于 2019-12-11 01:36:04
问题 I have a new converted MVC2 project running against the MVC2 source code. I have done this conversation twice on the same solution. I use strongly typed views on every page of the site and so far I haven't had any issues running against the source nor developing with strongly typed views. Now on one strongly typed view in particular the generic parameter is not being reflected in the Model property of that page. Instead of having a Model of type T I always have a Model of type object. The

asp.net mvc 2 wizard

让人想犯罪 __ 提交于 2019-12-11 01:26:27
问题 does anyone have a link to some code for a wizard control in asp.net mvc 2? preferable one without using the session ? i would like to persist all the values in between steps? 回答1: Pro ASP.NET MVC 2 Framework 2nd Edition 回答2: You can use the simple component MVCWizard.Wizard available on NuGet. The WizardController allows you to create a wizard using partial view. There is also the AutoWizardController that renders the entire wizard in a single view. All these components operate with the

how to deserialize jqgrid multiple group search criteria in asp .net mvc2

穿精又带淫゛_ 提交于 2019-12-11 01:15:44
问题 If multiple grouping is used, jqgrid advanced search can generate search criteria like {"groupOp":"AND","rules":[],"groups":[{"groupOp":"AND","rules":[{"field":"Nimi","op":"cn","data":"kk"},{"field":"Nimi","op":"cn","data":"kkk"}],"groups":[]}]} Trying to de-serialize it in ASP .NET MVC2 using var serializer = new JavaScriptSerializer(); var filtersList = serializer.Deserialize<Filter>(_filters); class Filter { public GroupOp groupOp { get; set; } public List<Rule> rules { get; set; } public

NerdDinner form validation DataAnnotations ERROR in MVC2 when a form field is left blank

只愿长相守 提交于 2019-12-11 01:09:18
问题 Platform: Windows 7 Ultimate IDE: Visual Studio 2010 Ultimate Web Environment: ASP.NET MVC 2 Database: SQL Server 2008 R2 Express Data Access: Entity Framework 4 Form Validation: DataAnnotations Sample App: NerdDinner from Wrox Pro ASP.NET MVC 2 Book: Wrox Professional MVC 2 Problem with Chapter 1 - Section: "Integrating Validation and Business Rule Logic with Model Classes" (pages 33 to 35) ERROR Synopsis: NerdDinner form validation ERROR with DataAnnotations and db nulls. DataAnnotations in

How to disable security for an Action in ASP.NET MVC?

北慕城南 提交于 2019-12-11 00:52:58
问题 My requirement is that only the login page and the Register page should be accessible from anonymous users. I have created a new ASP.NET MVC project using the default template in VS2008. After that I have enabled security adding this section to the web config: <authorization> <deny users="?" /> </authorization> Now the Register Action is not accessible anymore because of the security enabled. How I can do to disable security only for that Action? Thanks 回答1: You will want to use the Authorize

Session is NULL when running ASP.NET MVC inside of ASP.NET

青春壹個敷衍的年華 提交于 2019-12-11 00:01:46
问题 If I create an ASP.NET Web Application project and then add an ASP.NET MVC 2 to it using the default routes defined like so routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { action = "Index", id = UrlParameter.Optional } ); The Session object is NULL when I try and access it in the action methods of the controllers. If I change my routes to this. routes.MapRoute( "Default", // Route name "{controller}.aspx/{action}/{id}", // URL with