asp.net-mvc-5

How to call nested ajax call and send object data to controller in ASP.Net MVC 5

为君一笑 提交于 2019-12-24 08:02:04
问题 I have two controller Settings Controller Action - GetAvailableLocationsFor HomeController Action - Index Steps I want to acheive Make ajax call to GetAvailableLocationsFor and then get the object data from success call back. No view is required for this Action. Now with the object data received make another ajax call to Index Action in HOMECONTROLLER and pass the object there. Below is what I could achieve. HomeController - GetAvailableLocationsFor public ActionResult

Adding entity to Identity model

北城以北 提交于 2019-12-24 07:26:38
问题 I am currently getting an error I understand the error but I don't know where I am going wrong The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUsers_dbo.CompanyDetails_userCompanyID". The conflict occurred in database "PXWHITESPIDERDEV", table "dbo.CompanyDetails", column 'companyID'. Within the IdentityModel autogenerated when you create an MVC application public class ApplicationUser : IdentityUser { public async Task<ClaimsIdentity>

How to use aggregate functions in linq with joins?

六眼飞鱼酱① 提交于 2019-12-24 06:49:21
问题 Hi I am writing linq query to get max count with columns from the two tables. I write sql query and it is below. select MAX(p.dispalyOrder) from NCT_Process p INNER JOIN NCT_Process_Settings s ON p.projectId =s.projectId AND p.level=s.level I tried to linq as below. dbObject = (from c in entityObject.NCT_Process_Settings join process in entityObject.NCT_Process on c.projectId equals process.projectId join level in entityObject.NCT_Process on c.level equals level.level select new

Not sure where to place Scripts.Render for JQuery

爱⌒轻易说出口 提交于 2019-12-24 05:31:12
问题 I'm receiving a ' Uncaught TypeError: undefined is not a function ' while trying to call the autocomplete function in JQuery and I'm assuming I have my Scripts.Render in the wrong place. Where shouldthe JQuery scripts go within the layout.cshtml? My assumption was at the top but I can't seem to get it working no matter where I put them. Here is the top of my layout file: <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>

How to use data-ng-view in _layout.cshtml

不想你离开。 提交于 2019-12-24 05:13:10
问题 I am trying to crate a MVC application with Angular. My application has common Header and footer. So I added it in _layout.cshtml. There are some static pages in the application. Hence I want to load this using Angular routing. Here is my _layout.cshtml <!DOCTYPE html> <html data-ng-app="HappyHut"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>@ViewBag.Title - My ASP.NET Application</title> @Styles.Render("~/Content/css")

How to use data-ng-view in _layout.cshtml

心已入冬 提交于 2019-12-24 05:12:07
问题 I am trying to crate a MVC application with Angular. My application has common Header and footer. So I added it in _layout.cshtml. There are some static pages in the application. Hence I want to load this using Angular routing. Here is my _layout.cshtml <!DOCTYPE html> <html data-ng-app="HappyHut"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>@ViewBag.Title - My ASP.NET Application</title> @Styles.Render("~/Content/css")

502 - Web server received an invalid response while acting as a gateway or proxy server

若如初见. 提交于 2019-12-24 04:13:05
问题 When I publish my app to a Azure Website I get the error on the title and nothing works. It's not temporary. I researched and looks like it's not related to the problems people have that error have. I enabled logging but haven't got a much significat otuput. The log says: 2014-01-15 10:56:26 ~1MANDOOSYSTEM GET /diagnostics/settings X-ARR-LOG-ID=5632dfdf-9cda-482a-a1d8-e0a9944c8e51 443 - 70.37.162.148 Azure-Portal/3.14.00298.7 - - mandoosystem.scm.azurewebsites.net 200 0 0 463 939 1718 Ideas?

Extending CookieAuthenticationProvider OnValidateIdentity

独自空忆成欢 提交于 2019-12-24 03:46:20
问题 im trying to logout my users when they are dasabled or banned. my approarch was to extend CookieAuthenticationOptins in Startup.Auth.vb. According to many examples i found my Privider looks like this app.UseCookieAuthentication(New CookieAuthenticationOptions() With { .AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, .LoginPath = New PathString("/Account/Login"), .Provider = New CookieAuthenticationProvider() With { _ .OnValidateIdentity = Function(ctx) Dim ret = Task.Run

@Ajax.ActionLink is using GET instead of POST

馋奶兔 提交于 2019-12-24 03:37:17
问题 I am really bummed out that I can't figure out this simple problem even after hours of research: @Ajax.ActionLink("Test", "Test", new AjaxOptions { HttpMethod = "Post" }) <a data-ajax="true" data-ajax-method="Post" href="/Home/Test">Test</a> It's as simple as it can get but it makes a GET request to /Home/Test even though I specified POST. Inside _Layout.cshtml I have <body> @RenderBody() @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/jqueryval") @Scripts.Render("~/bundles

Why does Razor view add “CS$<>8__locals1” prefix to input names when accessing indexer of model assigned to local variable?

半腔热情 提交于 2019-12-24 03:29:50
问题 I'm building a simple ASP.NET MVC 5.2.3.0 view that displays a user name and a checkbox list of roles. You can check or uncheck the checkboxes to control which roles the user is in. Here is my ViewModel: public class EditUserVM { public string Id { get; set; } public string UserName { get; set; } public List<UserRoleVM> Roles { get; set; } } public class UserRoleVM { public string RoleId { get; set; } public string RoleName { get; set; } public bool IsMember { get; set; } } And it's displayed