Questions tagged [asp.net-mvc]

The ASP.NET MVC Framework stands out as a remarkable web application framework and tooling, based on open source concepts. It successfully incorporates a personalized variation of the model-view-controller (MVC) design pattern, specifically designed for creating and enhancing web applications. All this is made possible by building upon a solid foundation rooted in the innovative ASP.NET technology.

What is the best way to package JS in a partial view from ASP.NET MVC4 when it is sent back through AJAX?

Currently utilizing the System.Web.Optimization framework for bundling and minifying JavaScript, along with @section Script{ } sections to organize all scripts at the bottom of the page. This includes jQuery resources. In one of my pages, there's an ...

Tips for automatically selecting the day when choosing a date

I had created two fields named HolidayDate and HolidayDay with specific attributes as shown below: [Required] [DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)] [DisplayName(Constants.DisplayN ...

The resource was identified as a document but was sent using the MIME type application/json

I'm having an issue with posting to a jQuery modal's Action and receiving JSON in return. Every time I try, I encounter the following error: Resource interpreted as Document but transferred with MIME type application/json Instead of staying on the curren ...

The issue I am facing is that whenever I use an AJAX POST request,

I encountered an issue where the ajax post method was unable to pass a parameter to the controller, as the controller parameter always appeared as Null. Index.schtml: I attempted to initiate a new view via a parameter by triggering an element in HTML and ...

Utilizing jQuery GetJSON twice for ASP.NET MVC partial view

I've encountered an issue with a page that includes a html.RenderPartial, responsible for rendering an ASP.NET MVC partial view. The partial view serves as a jQuery dialog, opened from the same page it is rendered on. The problem arises when attempting t ...

Trouble with AJAX Post Request: Missing JSON Response

Below is the AJAX request I have created: var data = modalDom.find("form").serializeObject(); data["returnJson"] = true; $.ajax({ type: "POST", url: "/companies/edit/", data: data, dataType: "JSON", success: function (result) { ...

Using Ajax with aspnet mvc 5 to enhance Partial Views

I have a list of items in my shared HTML that are identified by IDs as names. I attempted to update a specific div by passing the ID through AJAX, but unfortunately, the div does not get updated. 1 Here is the list of companies : <div class="dropdown- ...

Troubleshooting problem with Zscaler and Ajax communication

When making an AJAX call on my website, everything runs smoothly except for when it is accessed behind a Zscaler proxy. In that case, the browser throws a CORS error: "No 'Access-Control-Allow-Origin' header is present on the requested resource." The spe ...

Guide to verifying the update of user information with sweet Alert on ASP MVC

I'm currently working on an ASP MVC web application that involves using stored procedures with SQL Server. My goal is to implement a confirmation alert (Sweet Alert) to confirm the data update for a logged-in user. The code for editing works fine without ...

Looking for a comprehensive pagination solution using jQuery and Ajax?

Hello, I've been struggling to implement pagination along with displaying data in my project. I have managed to display the data successfully, but incorporating pagination has proven to be a challenge for me. Does anyone have any examples or hints on how t ...

Sending information to a jQuery UI Dialog

I'm currently working on an ASP.Net MVC website where I display booking information from a database query in a table. Each row includes an ActionLink to cancel the booking based on its unique BookingId. Here's an example of how it looks: My book ...

Is there an issue with MVC5 in passing JSON data to Controller using Ajax?

I am working on implementing duplication checking in my MVC5/EF Code-First application. In the Asset View's Create() method, I use JavaScript to show/hide textboxes for adding a new location_dept/location_room: <div class="form-group"> <s ...

Performing CRUD Operations on SQL Database using ASP.NET MVC 5 and AJAX

I am working on implementing Ajax functionality to delete rows from my table without having the page refresh each time I try to remove a row. The code I have doesn't seem to be working properly when I click the Delete button: Controller: public Acti ...

The functionality of Breeze.js for saving changes fails unless the designated controller method is explicitly named as `SaveChanges()`

Hello, I am a beginner in BreezeJs I have a post method on my Controller // POST api/company/post [Authorize(Roles = "Admin")] [AcceptVerbs("POST")] [HttpPost] public object **SaveChanges**(JObject companyRequest) ...

Using the MVC framework, showcase a collection of images in real-time using AJAX and JQUERY

Managing a website where I fetch and display a list of thumbnail images from the database has proven to be a bit slow. The main issue lies in the time it takes to load each image using Url.Action, which goes through the entire MVC pipeline. To tackle this ...

Guide on breaking down a series of values within a jQuery datatable

I am facing an issue with a datatable where one column contains a list of values, such as Activity Phase Dates in a comma-separated format. Using render: function (data) { return moment(data).format("MM/DD/YYYY"); directly is not feasible because a list of ...

Implementing multiple jQuery Ajax requests in ASP.NET MVC: Efficiently handling concurrent requests

My web page has a tabbed style layout where each tab triggers an Ajax request for their content using jQuery. The backend is ASP.NET MVC running on Visual Studio with the 'ASP.NET Development Server' handling requests. I am encountering the follo ...

What is the most effective method for the server to communicate with a web client through message delivery?

If you have any links to articles related to this topic, please share them as I may not know the exact terminology to search for. I am interested in understanding how a web application can facilitate server-to-client communications. The internet was not o ...

Sending data with a post request using Ajax in ASP.NET MVC 3

Hey everyone, I'm working on an ajax login call. I'm serializing the form data and sending it to the server to get a redirect URL link. However, I'm running into an issue where my URL after the post ends up looking like http://localhost:508 ...

BreezeJS model, Knockout integration, empty relationships

I am facing an issue where, when using breeze manager.saveChanges(), only the navigation properties are not sent to the server. The rest of the data is being transferred properly. I am relatively new to Breezejs and hoping someone experienced can assist me ...

Start with Angular routing, then switch to mvc routing if needed

My project utilizes Angular and node.js on IIS 7.5 for the frontend, and a .NET Web API for backend calls. The Angular routing and API routing are working smoothly when testing with Visual Studio/IIS Express and ng serve. However, they run on separate por ...

What could be causing my ASP.Net MVC script bundles to load on every page view?

I'm a bit puzzled. The _layout.cshtml page I have below contains several bundles of .css and .js files. Upon the initial site load, each file in the bundles is processed, which makes sense. However, every time a new view is loaded, each line of code from e ...

Show User-Specific Information Using DataTable

After conducting extensive research, I have been unable to find a suitable example to reference. My goal is to customize my DataTable so that it only displays data relevant to the currently logged-in user (admin accounts will have access to all data). I am ...

Performing a task through an AJAX call in DNN MVC

During my DNN MVC development journey, I encountered another issue. I am unsure if this is a bug, a missing feature, or a mistake on my part. Let me elaborate on the problem below. My Objective I aim to trigger an action in my controller by making an AJA ...

Mastering the Cache-Manifest file configuration for optimal performance

I am experiencing a problem where even though I have my cache manifest, my website is not functioning correctly. Currently, I am working with Visio 2012, using asp.net MVC. Here are the steps I have taken so far: I created a file called Manifest.manifes ...

Is it possible to have two router.js files within a single Angular project?

Encountering a dilemma in my Angular UI routing project with rendering the view. Contemplating using two router.js files. Is it feasible to include two router.js files in one project? What drawbacks might arise from this approach? ...

Executing a Control Method in ASP.NET MVC with the Help of JQuery or AngularJS

I currently have an application that is running in MS Silverlight on the client side, with a WCF SOAP service hosted in IIS serving as the business layer, and SQL handling the database. However, I have been tasked with transitioning the front end from Silv ...

Display View with AJAX in the MVC pattern when server-side validation does not pass

I am currently working on a search form that involves client side validation, server action calls, and server side validation. This process can either return the original view with modelstate errors or display the search results. To achieve this functiona ...

jQuery Data Tables display the message "No data available in table" even when there is data present and visible on the table

After spending countless hours searching for a solution to my problem, I came across two potential fixes: one addressing "No Data Available in Table" for jQuery DataTables found here, and another dealing with the issue of data not displaying properly durin ...

Tips for choosing the dropdown selection on an ASPX website page

I have a specific dropdown menu set up, and I need to select the appropriate option from the viewdata object in my .aspx page. Here is what my menu looks like: <td headers="Vehicle" style="background-color:#EFF3FB;font-family: Verdana; font-size: 10px ...

Proper method for posting an object array through a form submission

I am currently integrating a payment service API into my application and following the instructions provided on their website. The documentation specifies that the POST body should have the following structure: api_hash=38be425a-63d0-4c46-8733-3e9ff662d62 ...

Issue with MVC HTML Helper DropDownListFor failing to submit the chosen value

I'm facing an issue with jQuery form serialize as it's not sending the value of the drop down list to the controller. The control is able to retrieve the ID and Name from the .cshtml file. HTML-code @using (Html.BeginForm("", "", FormMethod.Pos ...

Implementing Ajax functionality in MVC 3 to return a partial view

I wanted to express my gratitude for this invaluable site that has taught me so much. Currently, I am working on an MVC3 component where I need to populate a selectlist and upon user selection, load a partial view with the relevant data displayed. Everythi ...

JavaScript that Implements MVC Architecture Using C#

When working on a cshtml page within my View, I am able to easily retrieve the URL to an action using this line of code: <h1>@Url.Action("NewComment", "Case")</h1> If I include the same code in JavaScript like this: <script> alert( ...

Retrieve JSON data from a web API and transmit it to a partial view using a controller

Currently, my code is set up like this: public ActionResult Search(SearchModel model) { string url = "http://10.0.2.31/testwebapi/api/data"; WebClient wc = new WebClient(); wc.QueryString.Add("forename", model.Forename); ...

Using Razor view form with various submit buttons

In my razor view, I have a BeginForm command surrounded by a loop that generates an HTML table with a submit button in each row. My concern is how do I identify which specific row the submitted form corresponds to when sending it back to the controller? T ...

Developing multi-layered business solutions with Angular front-end that incorporate customized localization in .Net Core Entity MVC is essential for ensuring effective business logic implementation

Help me enhance and refine this code I faced challenges trying to understand and piece together this code (coding isn't my strong suit). Sharing knowledge is important, as encouraged by platforms like StackOverflow. Please help me improve and correct ...

Extract data from a deeply structured JSON object

Here is the structure of my JSON data: "{\"total_entries\":2,\"current_page\":1,\"total_pages\":1,\"per_page\":2,\"items\":[{\"workspace\":{\"background_color\":\"#ffedd3\",&b ...

MVC.NET: Offering User-Friendly Loading of Initial x Items with an Option to Load More

What would be the optimal approach to efficiently load only the initial 25 elements from an IEnumerable within an ASP.NET MVC Index view? Upon employing scaffolding, a controller and views have been constructed. Within the index page, there is a creation ...

Guide to updating a database using ajax and javascript in asp.net mvc without the need to refresh the page

Is there a way to update the value of an enumdropdownlist from "active" to "inactive" in my database through an ajax call without having to refresh the page? I am unsure whether to use a javascript method or ajax.beginform for this task. I attempted to us ...

Show image using Typescript model in Angular application

In my Angular (v8) project, I have a profile page where I typically display the user's photo using the following method: <img class="profile-user-img" src="./DemoController/GetPhoto?Id={{rec.Id}}" /> However, I am considering an alternative ap ...

Is it possible to utilize npm for handling the JavaScript of an ASP.NET MVC project?

Currently, I am in the process of creating an extensive client-side javascript application that involves a intricate web of Javascript dependencies. These dependencies are all accessible as npm modules. However, majority of the modules that I need are not ...

Learn how to showcase LINQ query results in a string array within an ASP.Net MVC view

I am working on integrating a tags input box into my application. After researching, I came across the library available at When it comes to the Controller Create Method: // GET: Posts/Create public ActionResult Create() { var Ta ...

Controller receiving empty object array from FormData

I am encountering an issue with my ajax call to the controller, where I am passing FormData() containing an array of objects and other properties. The list array that I pass seems to have 0 elements in the controller. Can anyone assist me with this problem ...

Is there a way to load an image asynchronously when the page loads and show a loading gif during the loading process?

My image tag displays a dynamically generated graph from the database. The loading time can vary significantly, sometimes only taking a second while other times it may take up to 6 or 7 seconds for the graph image to appear. I am looking for a way to sho ...

The onClick event is not executing my function

Having trouble triggering the onclick() event when trying to modify table data using ajax. Here's the code snippet: (the onclick() event is located in the last div tag) @{ ViewBag.Title = "Edit_Room"; Layout = "~/Views/Shared/_LayoutAdmin.cshtml"; ...

The ViewData does not contain an item of type 'IEnumerable<SelectListItem>' with the key 'print_ad_option_id'

One of my methods involves using ajax: function prodChange() { console.log(this.value); // initiating ajax request var url = '@Url.Action("GetAdvProdList", "Contract")' + '?prod_id=' + this.value; $.ajax({ url: ...

Using Entity Framework to create a one-to-many relationship in ASP.NET MVC 5 with code-first approach, and implementing jQuery autocomplete

I am looking to develop a straightforward website where users can post offers with specific details such as title, description, city, and time. Below is a snippet of my database diagram: https://i.stack.imgur.com/f5kcI.png Users can create multiple off ...

Exploring the wonders of AJAX in ASP.NET MVC 1.0 on the seamless IIS 6 platform

While working with AJAX and jQuery in ASP.NET MVC on IIS 6.0, I encountered an issue where invoking an action via jQuery resulted in a 403.1 error. Is there something specific that needs to be added to the web.config file to address this problem? Client-S ...

Checking for Session Expiry in Ajax Requests Using Asp.net MVC

We are currently implementing Ajax calls throughout our application and are looking for a universal solution to redirect users to the login page if their session has expired while attempting to execute an Ajax request. I have developed the following soluti ...

Employing the html.validationmessagefor to display a client-side error notification

My text fields have server-side validation messages. The field 'title' is a required field on the server side with a '[Required]' data attribute in the class, but it only seems to be checked on a postback or form submit. I am saving the 'title' text field ...

What could be causing the Ajax http get request to not be retrieving the JSON data as expected?

I am facing an issue with retrieving JSON or HTML from my MVC controller using an Ajax call. The problem arises when trying to make a GET request instead of a POST request. $.ajax({ url: url, type: "POST", //It works but doesn't work with GET ...

Displaying a separate page upon clicking the add button in jqGrid: Tips and Tricks

I am a beginner when it comes to MVC, jQuery, and jqGrid. I have been struggling for the past couple of days trying to figure out how to redirect to another page when the user clicks the add button. Additionally, I need to perform the same action when the ...

Can we implement a variety of site designs based on the size of the window?

Utilizing media queries allows us to modify the CSS for various screen sizes. My inquiry is: can we switch to a completely different page layout (or View in MVC) when the window size, specifically when the width is less than 500? Assuming that the control ...

submitting URL from dropdown menu without using the 'submit' button

My situation involves a dropdown list: @Html.DropDownList("InnerId", Model.GroupDropDownList, new { @class = "select_change" }) I am looking to achieve submitting the value when a user clicks on the selection without needing to select and then use a subm ...

Execute controller action upon item selection within KODataTable MVC table

I am displaying data in a table using AJAX to call an Action that returns a JSON list. Output: I want each user (row in the table) to be clickable and linkable to an edit page (Admin/Edit/Id). This can be done either by clicking on them or by having an E ...

MVC: Issue with client-side validation ceases to function after the initial opening and closing of SimpleModal AJAX popup

I am currently facing an issue with a view that includes a simplemodal popup window. When you click on a hyperlink, the window pops up, and if you try to submit the form in the popup without filling in any information, it displays the appropriate validatio ...

Encountering difficulty in reading a session variable when accessing it through Ajax, however, the variable is successfully retrievable when called from the controller in ASP.Net

I have implemented a method within the controller to retrieve the value of a session variable. However, when I attempt to call this method from Ajax jQuery, I am unable to obtain the value. Interestingly, if I try to read the session value from another met ...

Jquery Validation is not functioning properly in MVC using C#

I have been working on an MVC App and am currently trying to determine if a user is registered. To achieve this, I have created a model: public class Ejemplo { [Required(ErrorMessage="Please specify Username")] [DataType(DataType.Text)] public s ...

Submitting an mvc partial view form to send data from the parent view

I am currently working on a MVC 5 App where I have a Parent View that includes a Partial View, allowing users to load images. Upon submitting, the Parent view calls a .Ajax function defined within it, which in turn calls a Method/Controller. My requireme ...

Events are not loading in FullCalendar

I've integrated FullCalendar into my asp.net MVC application. However, I'm facing an issue where the events are not loading properly when fetched through an ajax call. Below is the code I'm using. Can you help me identify the problem? <d ...

Guide on incorporating HTML page into MVC 5 using AngularJS routing

I am trying to incorporate the SPA concept of AngularJS into MVC 5, but I am struggling with routing. My goal is to have my main page displayed using Razor and load specific sections of the page using AngularJS. I understand that my explanation may not b ...

Create an API using asp.net MVC technology within a web application framework

I have a MVC 3 Web Application with approximately 50 Views. I am curious if it is feasible to incorporate an API alongside these Views without any complications. In my ideal scenario, the server would be operational and every request would be directed to ...

Experiencing a 400 Bad Request error while attempting an Ajax call to a Controller in ASP.NET

Having trouble making a simple request from a CSHTML page to a Controller in my ASP.NET MVC website application. Attempting a DELETE call using Ajax: $.ajax({ url: "/company/delete", type: "DELETE", success: function (e) { showAlert(&a ...

Display Partial View in MVC 4 using ajax success callback

Issue: Unable to load view on ajax success. Situation: I have two cascaded dropdowns where the second dropdown's options are based on the selection of the first dropdown. Upon selecting an option in the second dropdown, I want to display a list of records ...

When utilizing the Jquery Upload File Plugin, it is important to note that the collection IEnumerable<HttpPostedFileBase> may not include any

I have implemented the jquery upload file plugin to enable multiple file uploads. I have properly included the necessary CSS and JavaScript references for file uploading. However, when I try to save the uploaded files after entering the client name and att ...

Guide to serializing JSON in C# without nested elements

I have developed a controller to send JSON data to a mobile application. The following code snippet shows the action I used: public JsonResult GetFirm(int id) { Firm firm = new Firm(); firm = dbContext.Firms.FirstOrDefault(s => s.id == id); ...

Using Angular and C#, learn how to efficiently incorporate functionality for saving lists, including the addition, removal, and saving of items

I am working on an application that involves managing a list of objects within a web view. Upon loading the page, an AJAX request is triggered to an ASP MVC controller. The controller utilizes Entity Framework to retrieve the list of objects from a SQL se ...

Transferring information to a partial view using a jQuery click event

In my Index view, there is a list of links each with an ID. My goal is to have a jQueryUI dialog box open and display the ID when one of these links is clicked. Currently, I am attempting to use a partial view for the content of the dialog box in order to ...

You will need to return a string instead of a Json Object in order for it to function correctly

I am facing an issue where I need to return a list of json objects to the view, but it seems to be causing problems because it's being returned as an object. It works fine if I return a string or a list of strings instead. However, what I really need ...

Rely on the razor method for generating URLs

I need to direct to a specific page, so I have implemented a JavaScript function in my MVC project: function rootUrl(url) { var _rootUrl = '@Url.Content("~")'; var x = url; if (url.indexOf(_r ...

Share a model between two partial views within the same view

I'm facing an issue with loading two partial views in my main view. The main view is set to automatically refresh partial view 1, while partial view 2 should only update when a user clicks on an Ajax.ActionLink from partial view 1. This click event should ...

Conflicts between Bootstrap Validator and Ajax.BeginForm in Partial Views of MVC

My current issue involves using Ajax.BeginForm to post data on a form without refreshing the entire page. The goal is to validate a textbox - if it has a value, then the data should be posted; otherwise, a validation message should be displayed. However, I ...

What is the reason behind MVC model binding correctly resolving a complex object when the request is made through POST, but not resolving it when made through GET?

Within my controller, I have created a Customer ViewModel class as showcased below. This class consists of two properties: FirstName and LastName, along with a third property named Orders which is essentially a collection of Order objects public class Cu ...

What could be causing the select2 to not display the most up-to-date information in the control?

I have implemented a progressive search feature but it seems that the data returned is not populating the control properly. $("#selUser").select2({ ajax: { url: "/M01EngineeringData/GetFunctionalLocations", ty ...