razor-pages

Multiple Submit Buttons in Razor Pages not able to find handler pageName?handler=OnPostUploadImage

感情迁移 提交于 2020-04-17 20:17:45
问题 I am trying to upload Image using Ajax method in asp.net core Razor pages, I am main form in will all input fields are kept and with the form for Fileupload i am also added addition button which is for file upload using Ajax, When i hit the <input type="submit" value="Upload Image" asp-page-handler="OnPostUploadImage" id="btnUploadImage" /> i want it to call OnPostUploadImage method in pageModel file but it alway goes to default OnPost method. when i rename the OnPost to OnPost2 nothing

Multiple Submit Buttons in Razor Pages not able to find handler pageName?handler=OnPostUploadImage

≯℡__Kan透↙ 提交于 2020-04-17 20:17:39
问题 I am trying to upload Image using Ajax method in asp.net core Razor pages, I am main form in will all input fields are kept and with the form for Fileupload i am also added addition button which is for file upload using Ajax, When i hit the <input type="submit" value="Upload Image" asp-page-handler="OnPostUploadImage" id="btnUploadImage" /> i want it to call OnPostUploadImage method in pageModel file but it alway goes to default OnPost method. when i rename the OnPost to OnPost2 nothing

Multiple Submit Buttons in Razor Pages not able to find handler pageName?handler=OnPostUploadImage

五迷三道 提交于 2020-04-17 20:11:38
问题 I am trying to upload Image using Ajax method in asp.net core Razor pages, I am main form in will all input fields are kept and with the form for Fileupload i am also added addition button which is for file upload using Ajax, When i hit the <input type="submit" value="Upload Image" asp-page-handler="OnPostUploadImage" id="btnUploadImage" /> i want it to call OnPostUploadImage method in pageModel file but it alway goes to default OnPost method. when i rename the OnPost to OnPost2 nothing

C# Asp.net Cascading drop-down select lists using Searchable Options List plugin

我与影子孤独终老i 提交于 2020-03-25 18:57:07
问题 Started a new question as the problem has moved. You can read how we came to this in this post. stackoverflow.com/questions/60379943 I now have working code but for some reason the script formatting is interfering with the population of the drop-down select list. I can get the list to populate on the view by removing this code from the page. $(function () { $('select').searchableOptionList({ maxHeight: '250px' }); }); All this does is make the drop-down list formatted to a style and the

C# Asp.net Cascading drop-down select lists using Searchable Options List plugin

南笙酒味 提交于 2020-03-25 18:56:12
问题 Started a new question as the problem has moved. You can read how we came to this in this post. stackoverflow.com/questions/60379943 I now have working code but for some reason the script formatting is interfering with the population of the drop-down select list. I can get the list to populate on the view by removing this code from the page. $(function () { $('select').searchableOptionList({ maxHeight: '250px' }); }); All this does is make the drop-down list formatted to a style and the

Object reference not set to an instance of an object ViewData[“Title”] = “Index”;

放肆的年华 提交于 2020-03-24 00:29:16
问题 So I'm trying to create a register razor page in my index page using a modal. Most of the form code that I imported into the modal is from the existing external register page. When I start up the mvc app, though, I receive a Object reference not set to an instance of an object error. Any help would be appreciated. Thanks! Console: System.NullReferenceException: Object reference not set to an instance of an object.at AspNetCore.Views_Home_Index.ExecuteAsync() in C:\Users\SalvadorSolis\source

Errors and warnings using @functions block in Razor Pages

青春壹個敷衍的年華 提交于 2020-03-23 07:49:26
问题 Because the @helper directive is no longer supported in ASP.NET Core Razor Pages, I've been using the @functions directive instead. @functions { void RenderTask(Models.Task task) { <tr> <td class="@Model.CssClass"> <p class="compact"> <span class="font-weight-bold">@task.Title</span> @if (!string.IsNullOrWhiteSpace(task.Description)) { <br />@task.Description } </p> </td> <td class="@Model.CssClass"> <img src="~/images/Edit.png" class="edit-area button-img" data-id="@task.Id" title="Edit" />

How do I search a list of concatenated names coming from another page model?

╄→尐↘猪︶ㄣ 提交于 2020-03-21 19:26:50
问题 I have multiple models in my project, but in the screen below, most of the fields/properties reside in the SecurityLog model. Below is where I am displaying the concatenated list of officers. I have search and column header sorting working correctly for everything except for the officer names. I am having difficulty incorporating the officer names b/c the list is coming from another page model. And here is my database schema and sample results I have sort, search and paging that I was able to

ASP.net MVC core RedirectToPage error - specify root relative path error

浪子不回头ぞ 提交于 2020-03-21 19:08:08
问题 I want to redirect to a razor page from a normal controller action like this: return RedirectToPage("Edit", new { id = blogId }); I have already a razor page named "Edit" which is working when navigating to it normally: With RedirectToPage I get the following error: InvalidOperationException: The relative page path 'Edit' can only be used while executing a Razor Page. Specify a root relative path with a leading '/' to generate a URL outside of a Razor Page. Any idea how to specify that path?

ASP.net MVC core RedirectToPage error - specify root relative path error

大城市里の小女人 提交于 2020-03-21 19:08:08
问题 I want to redirect to a razor page from a normal controller action like this: return RedirectToPage("Edit", new { id = blogId }); I have already a razor page named "Edit" which is working when navigating to it normally: With RedirectToPage I get the following error: InvalidOperationException: The relative page path 'Edit' can only be used while executing a Razor Page. Specify a root relative path with a leading '/' to generate a URL outside of a Razor Page. Any idea how to specify that path?