Questions tagged [asp.net-core-mvc]

ASP.NET Core MVC stands as an innovative presentation framework tailored for crafting vibrant websites using ASP.NET Core. It serves as a springboard for constructing both controller-based MVC sites and Razor pages that rely on view models. Exceptional functionalities come bundled within MVC, encompassing routing capabilities, seamless model binding and validation mechanisms, flexible filter options, robust web APIs, and the power of the Razor view engine.

Add an image to IFromFile in your ASP.NET Core MVC application

I'm looking to allow users to upload images, save them as IFormFile, and then store them in a database. Here's what I have so far: In the product controller, there is only an add action for both get and post methods, the product model, and the add new vie ...

Angular applications hosted on .Net Core should include a robots.txt file to provide instructions to web

I am currently running a web application on a Windows server, built with Angular 5 for server side rendering and hosted within .Net Core. I recently uploaded a robots.txt file to the root directory of the server, but when attempting to access it via , the ...

How can I implement a AJAX GET request with a parameter in ASP.Net Core 2 Razor

Is there a way to send an AJAX GET request in my ASP.Net Core 2 Razor Application with a parameter that needs to be passed to the destination function? For instance, I have a Select field in my HTML. Depending on what value is selected, I want to retrieve ...

Learn how to utilize JQuery for downloading a file or incorporate Ajax to showcase an error page

I am currently developing a single-page application utilizing ASP.Net Core MVC and JQuery. Due to the fact that full-page refreshes would reset some lengthy processes, I have opted to implement AJAX for all navigation tasks. One of the functionalities I a ...

Steps to open a PDF from a Response MemoryStream in a new tab

I'm not entirely sure if this is the right approach. My goal is to display a PDF in a new browser tab. I have a method that generates a MemoryStream and returns it to my ajax call. What is the best procedure for achieving this? Here is my Ajax Call: $(" ...

Unable to display modal pop-up in ASP.NET Core MVC web application

I have developed a web application using ASP.NET CORE MVC. I encountered an unusual issue while trying to display a modal popup using JQuery. The div structure I am working with is as follows: <div class="modal fade" tabindex="-1" r ...

Using Ajax to send data to a model within another model in ASP.NET Core MVC

I'm new to this platform and I'm curious about sending model data within another model from ajax to controller. Here are my models: public class mfItems { [Key] [Display(Name = "Item ID")] public string ItemID { get; set; } ...

What could be causing the 500 error from localhost Next.js GetStaticProps when trying to access a localhost C# ASP.NET Core API route

I currently have a C# / ASP.NET Core Web API project running on https://localhost:7001 and a Next.js app running on http://localhost:3000. The C# API runs successfully from Swagger and in the browser (https://localhost:7001/api/SourceSystems), but when tr ...

Tips for managing and modifying information with a dropdownlist in asp.net core mvc and angular js

In my asp.net core MVC project, I am incorporating AngularJs to manage two dropdown lists and a textbox. While the textbox functionality for saving and editing data works well, I am facing issues with resetting the dropdown lists after posting data and not ...

Editing content directly within an ASP.NET Core MVC application through AJAX encounters a 400 error, indicating a Bad Request

I'm attempting to implement inline editing using AJAX in ASP.NET Core MVC, but I keep receiving a 400 error (Bad Request). The idea is to click on a table row to edit and save the new values in an SQL database. Could someone confirm if I am on the right ...

The Net Core controller did not receive the ajax data as expected

My ajax call seems to be having an issue as the data is not getting passed to my controller correctly. Ajax $.ajax( { url: 'Playlist/AttachVideoToPlaylist', contentType: "application/json; charset=utf-8", ...

Error encountered during parsing of value in Json.net using C#:

Whenever I attempt to retrieve JSON data from a URL, I encounter the error mentioned above. public class Product { public int Id { get; set; } [JsonProperty("externalId")] public int ExternalId { get; set; } [JsonProperty("code")] pub ...

Identifying copy and paste behavior within an HTML form using .NET CORE MVC 2.1

I inherited a project at my current company and one of the tasks involves allowing users to paste multiple ISBN numbers from Excel into a search field on my Index page (HTML). Sometimes, the ISBNs are poorly formatted with letters or special symbols mixed ...

Challenge: Visual Studio 2015 MVC6 and Angular 2 compilation issue - Promise name not found

Initially, I've made sure to review the following sources: Issue 7052 in Angular's GitHub Issue 4902 in Angular's GitHub Typescript: Cannot find 'Promise' using ECMAScript 6 How to utilize ES6 Promises with Typescript? Visual Studio Code error: Cannot ...

Utilizing TypeScript in a browser with a .NetCore WebApplication

After going through numerous articles, I have not been successful in finding a solution. My challenge lies with a .net core WebApplication that utilizes typescript code instead of javascript. Here are the specific requirements: I need to be able to debu ...

400 Error: Frustrating AJAX POST Request Woes

Attempting to send data to a controller using the POST method with jQuery AJAX. Below is the code being used: $('#save_new').on('click', function () { var category_name = $('#new_category').val(); var description = $('#new ...

Is AJAX causing issues with updating the ASP.NET Core MVC view accurately?

My application is built using ASP.NET Core 6 MVC. I have a table on a page where I want to enable drag and drop functionality for its rows. After rearranging the rows, users can click on "Submit" to make the changes permanent. Once submitted, the changes ...

TimeoutException occurs in Browser when using Visual Studio with ASP.NET and Angular

After waiting for 60 seconds, an error message appeared in the browser when trying to debug. However, after refreshing the browser window and waiting for another 15 seconds, everything seemed to be working fine. An unexpected error occurred during the r ...

Posting data in ASP.NET Core from the frontend to the backend (specifically with React) involves sending information

In my React code, I have a function to hit the API when the submit button is clicked. I update the question and add a new class called httpresponemessage post. const handleOnPreview = (e) => { e.preventDefault(); setsubmittext(text); ...

ASP.NET Core MVC: Issue with Passing C# Razor Variable to HTML Tag

GitHub Repo: https://github.com/shadowwolf123987/Gun-Identification-App I'm currently facing an issue in passing the values of two C# variables from the code block defined in my view to the corresponding html tags within the same view. Unfortunately, the ...

Send a string to the controller through an AJAX request

Seeking assistance on creating a search field to find users within my system. The idea is to input the user's name into the field, then use an Ajax function to pass that name from the search field to a method in the controller. This method will return ...

Passing Table values from a View to a Controller in ASP.Net MVC

In my view, I have created a table that functions as a timesheet with an option to add more rows using a button. <table class="table table-bordered table-responsive table-hover" id="mytab" cellspacing="0" cellpadding=" ...

Retrieve information from JsonResult

While working with ASP.NET Core, the MVC controller is returning JSON data. I am currently attempting to retrieve this data in a unit test. The best solution so far has been string data = JsonConvert.SerializeObject(jsonResult.Value); and then comparing ...

Creating a form in ASP.NET Core 8 MVC with dynamic updates using Ajax - here's how!

As a newcomer to C# and ASP.NET MVC, I am encountering difficulties in updating a section of form controls in my current ASP.NET Core 8 project. Research suggests using partial views and Ajax for this purpose, but I am facing model binding issues after the ...

Blending ASP.NET Core 2.0 Razor with Angular 4 for a Dynamic Web Experience

I am currently running an application on ASP.NET Core 2.0 with the Razor Engine (.cshtml) and I am interested in integrating Angular 4 to improve data binding from AJAX calls, moving away from traditional jQuery methods. What are the necessary steps I need ...

Omitting Null Values when sending data to JSON using the JsonResult in an MVC application

I have a sample of Json data below. Although the object is more intricate in reality, this snippet showcases my query. I am interested in reducing the size of the Json response that is being generated. Currently, it is created using the standard JsonResu ...

A combination of MVC6, tsd, and typings has proven to be

Given that TSD has been officially deprecated, I am looking towards the future and seeking guidance on how to use typings in the MVC6 framework. Any advice or tips would be greatly appreciated. I attempted following a tutorial from the typings website, wh ...

Altering the color of numerous labels using ajax jQuery and .NET Core MVC

I have developed a feature that allows users to choose answers using radio buttons. Once the user has selected all answers and clicked Submit, the answer labels will be displayed in the following three scenarios: If the user selects the correct answer lab ...

Automatically populate select2 dropdown in ASP.NET MVC Core using AJAX

Currently, I am working on a feature to automatically populate text boxes and drop-down fields in my view. To achieve this, I am using a list that I query again. I came across an example that I am referencing here. However, when trying to debug, the break ...