본문 바로가기

MVC

(8)
error CS1061: 'int' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?) error CS1061: 'int' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?) 1. 원인 entoty framework 에 매핑 한 stored procedure 가 model 을 제대로 생성 할 수 없을때 발생하는 오류입니다.1-1. 예sp 내부에 #TEMP 테이블 join이나 select 가 있으며 list 로 가져올 컬럼을 매핑 할 수 없을 때 발생합니다. 즉, var onbidObjectList =..
asp.net mvc ajax post 500 error javascript var formCollection = $("#frmUser").serialize(); $.post("/UserInfo/ValidateUser", formCollection, function (status, textStatus, jqXHR) { if (status.Success) { alert("OK"); } else { alert("FAIL"); } }); controller [HttpPost]public JsonResult ValidateUser(FormCollection formValues){ JsonResult result = new JsonResult(); stirng param1 = formValues["param1"]; stirng param2 = formValues["pa..
bundle 403 error bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/css/Kcommon.css", "~/Content/css/Kmain.css", "~/Content/css/Ksub.css", "~/Content/css/Kboard.css")); ~/Content -> ~/bundles 로 변경 bundles.Add(new StyleBundle("~/bundles/css").Include( "~/Content/css/Kcommon.css", "~/Content/css/Kmain.css", "~/Content/css/Ksub.css", "~/Content/css/Kboard.css"));
[ASP.NET MVC] Make sure that the controller has a parameterless public constructor 유발소스 ASP.NET MVC /Controller/FileController.cs public string storageRoot { get; set; } public FileController() { storageRoot = Server.MapPath("~/App_Data/Upload"); } public FileController(ServerPathProvider pathProvider) { storageRoot = pathProvider.MapPath(); } public string DoSomething(string path1, string path2, string filename) { return StorageRoot + "\\" + path1 + "\\" + path2 + "\\" + file..
Upgrading mvc4 to mvc5 in vs2013 mvc4 -> mvc 5.2.3.0nuget package manager > asp.net mvc인스톨 되어 있으면 솔루션 탐색기 참조에서 System.Mvc 의 버전 체크 4.0.0.0 이면 System.Web.Mvc 참조 삭제 후 해당 솔루션 밖 패키지 폴더에서패키지 폴더 > Microsoft.AspNet.Mvc.5.2.3 > lib > net45 > System.Web.Mvc.dll 참조 추가 NuGet Package Console 창에서 Install-Package -Id Microsoft.AspNet.WebHelpers Install-Package Microsoft.AspNet.Web.Optimization Install-Package Microsoft.AspNet.WebPages.Data In..
C# Override Object Equals /*** * Excerpted from "Test Drive ASP.NET MVC", * published by The Pragmatic Bookshelf. * Copyrights apply to this code. It may not be used to create training material, * courses, books, articles, and the like. Contact us if you are in doubt. * We make no guarantees that this code is fit for any purpose. * Visit http://www.pragmaticprogrammer.com/titles/jmasp for more book information. ***/ usin..
Ajax.beginForm 이 작동하지 않을때 VS2013 기준 TOOLS > NuGet PakageManager > Manage NuGet Pakages for Solution... > Installed pakages 에서 "Miscrosoft jQuery Unobtrusive Ajax " 설치 유무 확인하세요. 없으면 Online 탭에서 검색 후 설치하세요. BundleConfig.cs public class BundleConfig { // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBu..
[ASP.NET MVC] 도로명주소 검색하기 소스 도로명주소 안내시스템(http://www.juso.go.kr/openIndexPage.do) 의 open api 연계가이드를 바탕으로 작성하였습니다. 가이드에서 제공하는 url에 직접 ajax 호출시 IE 저버전(7,8,9)에서 XSS가 발생함. jQuery 의 권고 ( $.support.cors = true; ) 적용시 보안 컨텐츠경고창이 뜨게되니 이방법도 패스~ Ajax 호출부 URL을 로컬 경로로 변경하고 HttpWebRequest 로 호출 후 string 으로 결과값 반환하는 방식으로 변경 Controller public string RoadAddress(string confmKey, int currentPage = 1, int countPerPage = 10, string keyword = ""..