asp.net-mvc-2

ASP.NET MVC - Pass Json String to View using ViewData

北战南征 提交于 2019-12-18 12:23:14
问题 I'm trying to pass Json to my View using ViewData Controller ViewData("JsonRegionList") = Json(RegionService.GetActiveRegions()) view $("input#UserRegion").autocomplete({ source:"<%: ViewData("JsonRegionList").ToString %>", minLength: 3, but the problem I'm running into is the output source looks like $("input#UserRegion").autocomplete({ source:"System.Web.Mvc.JsonResult", minLength: 3, which is obviously not right. Am I missing something basic? 回答1: The Json() controller method returns a

Remove Duplicate based on column value-linq

为君一笑 提交于 2019-12-18 11:55:47
问题 i have many to many relationship between employee and group. following linq statement int[] GroupIDs = {6,7}; var result = from g in umGroups join empGroup in umEmployeeGroups on g.GroupID equals empGroup.GroupID where GroupIDs.Contains(g.GroupID) select new { GrpId = g.GroupID,EmployeeID = empGroup.EmployeeID }; returns groupid and the employeeid. and result is GrpId | EmployeeID 6 | 18 6 | 20 7 | 19 7 | 20 I need to remove the rows for which the employeeid is repeating e.g. any one of the

ASP.net MVC v2 - Debugging Model Binding Issues - BUG?

荒凉一梦 提交于 2019-12-18 11:45:57
问题 I am having more than a little difficulty trying to debug why MVC is not binding correctly in a given case I have... Basically, I have my action which receives a complex object which in turn has a complex child object - Activity.Location.State (Where Activity is the complex object that the action expects, Location is a complex child object and State is just a string). Now I set up a test project which as far as I can tell exactly mimics the actually scenario I have, in this test case the

Providing or Filtering assemblies when registering areas for an ASP.NET MVC 2.0 application

假装没事ソ 提交于 2019-12-18 11:34:30
问题 I have a large application that currently exists as a hybrid of WebForms and MVC 2.0. Startup of my application is dreadful, and the culprit is primarily because of the AreaRegistration.RegisterAllAreas call. More specifically, that it is using the System.Web. Compilation.BuildManager.GetReferencedAssemblies to enumerate all types in assemblies directly referenced by the application and test them to see if they derive from AreaRegistration . Unfortunately, I have a number of third-party

Are multiple asserts bad in a unit test? Even if chaining?

六月ゝ 毕业季﹏ 提交于 2019-12-18 10:33:11
问题 Is there anything wrong with checking so many things in this unit test?: ActualModel = ActualResult.AssertViewRendered() // check 1 .ForView("Index") // check 2 .WithViewData<List<Page>>(); // check 3 CollectionAssert.AreEqual(Expected, ActualModel); // check 4 The primary goals of this test are to verify the right view is returned (check 2) and it contains the right data (check 4). Would I gain anything by splitting this into multiple tests? I'm all about doing things right, but I'm not

What to keep in mind when developing a multi-tenant asp.net MVC application?

这一生的挚爱 提交于 2019-12-18 10:24:46
问题 Good afternoon - I have a pretty general question today - I've been tasked with creating a web application to manage some basic information on customers. It's a very simple application, but what I don't know is what to keep in mind to develop the site around supporting multiple users at their own domains or subdomains of our url? How would I restrict users from logging in to each others portion of the app? I've seen mention of database scoping in similar questions on Stack Overflow, could

Handling Multiple Roles in MVC - Action-based Accessibility

喜欢而已 提交于 2019-12-18 10:17:26
问题 I currently have a project that I seem to have ran into an issue regarding Roles and thought I would get some opinions on how to best handle the problem. The system will require editable, flexible roles that control not only the access of specific areas, but also the use of system functions (Adding Users, Editing Users, Viewing Reports etc.) The system currently allows users to have multiple roles, each of those roles has explicitly defined areas of access/actions, for example: Role A can

Why use ASP.NET MVC 2 for REST services? Why not WCF?

余生长醉 提交于 2019-12-18 10:16:17
问题 So I see that MVC 2 now supports [HttpPut] and [HttpDelete] as well as [HttpGet] and [HttpPost] , making it possible to do a full RESTful Web service using it. I've been using the REST toolkit for WCF for a while and find it fairly powerful, but I'd be interested to find out what (if any) advantages there are using the MVC 2 approach. Links, war stories, or even pure hear-say are welcome. 回答1: I'm pretty sure ASP.NET MVC has supported all the HTTP verbs since the beginning. At least the

Python vs C#/.NET — what are the key differences to consider for using one to develop a large web application?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 10:05:21
问题 My organization currently delivers a web application primarily based on a SQL Server 2005/2008 back end, a framework of Java models/controllers, and ColdFusion-based views. We have decided to transition to a newer framework and after internal explorations and mini projects have narrowed the choice down to between Python and C#/.NET. Let me start off by saying that I realize either technology will work great, and am looking for the key differentiators (and associated pros and cons) These

Python vs C#/.NET — what are the key differences to consider for using one to develop a large web application?

天大地大妈咪最大 提交于 2019-12-18 10:04:06
问题 My organization currently delivers a web application primarily based on a SQL Server 2005/2008 back end, a framework of Java models/controllers, and ColdFusion-based views. We have decided to transition to a newer framework and after internal explorations and mini projects have narrowed the choice down to between Python and C#/.NET. Let me start off by saying that I realize either technology will work great, and am looking for the key differentiators (and associated pros and cons) These