asp.net-mvc

How to localize Range attribute?

北城余情 提交于 2021-02-07 19:43:39
问题 So I need to localize this [Range(1, 150, ErrorMessage = "")] I tried to use [Range(1, 150, ErrorMessage = MyApp.Properties.Resource.ErrorMessageMustBeBetween)] where MyApp.Properties.Resource.ErrorMessageMustBeBetween is "{0} must be between {1} and {2}." and it says An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type How it could be done then? Thank you! 回答1: You need to use ErrorMessageResourceType and

Multiselect list in Kendo Grid inline editing

混江龙づ霸主 提交于 2021-02-07 19:43:35
问题 I need to use multiselect list in kendo grid (inline editing) so that user can select multiple values from the list per row. Following are my requirements: At the time of display, kendo grid should show comma separated list of all the selected values. At the time of Add, kendo grid should show multiselect list and allow to select multiple values. At the time of Edit, kendo grid should show multiselect list with already selected values. User should be able to modify the select and add/remove

How to redirect to an external URL with POST parameters in a controller

耗尽温柔 提交于 2021-02-07 19:21:58
问题 How can I redirect from a controller to an external URL using POST method and passing some parameters? Basically I need to do automatically what a form would do. I found Redirect method in my controller, but it only seems to accept a url string. No method nor parameters. 回答1: You can't do post with server side redirect. Options: perform POST on server and handle results servers side (does not work if you need cookies to be set or used on destination server by that post request) perform post

How to redirect to an external URL with POST parameters in a controller

时间秒杀一切 提交于 2021-02-07 19:21:46
问题 How can I redirect from a controller to an external URL using POST method and passing some parameters? Basically I need to do automatically what a form would do. I found Redirect method in my controller, but it only seems to accept a url string. No method nor parameters. 回答1: You can't do post with server side redirect. Options: perform POST on server and handle results servers side (does not work if you need cookies to be set or used on destination server by that post request) perform post

jQuery.parseJSON not working for JsonResult from MVC controller action

ぃ、小莉子 提交于 2021-02-07 17:22:13
问题 I am trying to use jQuery.parseJSON to parse out the return value from an MVC3 controller action. Controller: [HttpPost] public JsonResult LogOn(LogOnModel model, string returnUrl) { .. do stuff .. if (errors.Count() < 0) { return Json(new object[] { true, model, errors }); } return Json(new object[] { false, model, errors }); } jQuery: $.ajax({ url: form.attr('action'), type: "POST", dataType: "json", data: form.serialize(), success: function (data) { var test = jQuery.parseJSON(data); } });

How many DbContext subclasses should I have, in relation to my models?

孤人 提交于 2021-02-07 14:44:32
问题 I'm learning ASP.NET MVC and I'm having some questions that the tutorials I've read until now haven't explored in a way that covers me. I've tried searching, but I didn't see any questions asking this. Still, please forgive me if I have missed an existing ones. If I have a single ASP.NET MVC application that has a number of models (some of which related and some unrelated with each other), how many DbContext subclasses should I create, if I want to use one connection string and one database

How many DbContext subclasses should I have, in relation to my models?

二次信任 提交于 2021-02-07 14:42:18
问题 I'm learning ASP.NET MVC and I'm having some questions that the tutorials I've read until now haven't explored in a way that covers me. I've tried searching, but I didn't see any questions asking this. Still, please forgive me if I have missed an existing ones. If I have a single ASP.NET MVC application that has a number of models (some of which related and some unrelated with each other), how many DbContext subclasses should I create, if I want to use one connection string and one database

Difference between authentication and authorization filters in aspnet-mvc5

巧了我就是萌 提交于 2021-02-07 14:27:24
问题 Why authentication filter is included in mvc 5? What is the major difference between authentication filter and authorization filter in mvc 5? 回答1: I found the following blog post: ASP.NET MVC 5 Authentication Filters Basically its about separation of concerns. Authentication: find out WHO issued a request. Authorization: find out whether a known user is allowed to perform a certain action. 回答2: To answer this you must understand the difference between authentication and authorization . Simply

Difference between authentication and authorization filters in aspnet-mvc5

守給你的承諾、 提交于 2021-02-07 14:26:11
问题 Why authentication filter is included in mvc 5? What is the major difference between authentication filter and authorization filter in mvc 5? 回答1: I found the following blog post: ASP.NET MVC 5 Authentication Filters Basically its about separation of concerns. Authentication: find out WHO issued a request. Authorization: find out whether a known user is allowed to perform a certain action. 回答2: To answer this you must understand the difference between authentication and authorization . Simply

TFS:The “Microsoft.Reporting.RdlCompile” task could not be loaded from the assembly Microsoft.ReportViewer.WebForms, Version=11.0.0.0

会有一股神秘感。 提交于 2021-02-07 14:23:15
问题 I have a mvc5 web application in TFS server 2013. When I build the solution locally, its working fine. I created a Build definition in TFS and tried to Build, it returned below compiler error. "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\ReportingServices\Microsoft.ReportingServices.targets (24): The "Microsoft.Reporting.RdlCompile" task could not be loaded from the assembly Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91.