Click here to Skip to main content
15,891,745 members
Everything / MVC / MVC5

MVC5

MVC5

Great Reads

by raddevus
Part 1: Master the ASP.NET MVC Project Template & Technologies (Razor, jQuery, JavaScript, Bootstrap, CSS). Part 2: Build an ASP.NET MVC app which runs in the browser but feels like using a desktop app.
by Mostafa Asaduzzaman
Simple Message/Reply app using MVC 5
by Simon B.
How to localize an ASP.NET MVC application and read all text from a database while still using DataAnnotations.
by kannankeril
This article is an attempt at splitting out the controller layer to reduce its complexity and improve quality and maintainability of the resulting code.

Latest Articles

by Shaurya Servegar
How to implement Custom RouteHandler and Custom Handler in ASP.NET MVC 5
by Saineshwar Bageri
In this article, we are going to learn how to implement the best Logging libraries available in the market for an ASP.NET MVC application.
by Yogi S.
Tutorial on implementing OpenWeatherMap API in ASP.NET MVC. It will teach how to get real time weather data of any city of the world.
by Proneetkumar Pradeep Ray
JQuery Datatable (Dynamic columns) populate after Ajax JSON response via server side processing - Using EF Raw SQL query

All Articles

Sort by Updated

MVC5 

U 21 Apr 2024 by Shubham Sawant 2023
1. In my project i develop resume my fetching data from action method to view. after fetching all data to the view (where i bind my template), i want to download that template with data and design.my all data get's fetched successfully but I'm...
13 Apr 2024 by Dave Kreskowiak
You're going to have to get a hold of Syncfusion[^]. It's their control and they have the documentation and support for it.
13 Apr 2024 by Shubham Sawant 2023
1.I want to Open the .docx(word file) in the View (.cshtml) where i want to see the word file and able to edit it. 2. Folder Structure: I'm working on the Jobseeker module and the .docx File uploaded by the Admin and that file present in the...
15 Feb 2024 by Richard Deeming
The error message is slightly confusing, but once you see it, the problem is obvious: Quote: Please specify one of either an InputStream or a FilePath to be PUT as an S3 object. The error is telling you that you have specified both an...
15 Feb 2024 by itsathere
File.WriteAllBytes("D:/" + model.FileBase.FileName, model.FileBase.Data); byte[] bytes = Convert.FromBase64String(model.file); using (var inputStream = new MemoryStream(model.FileBase.Data)) { ...
8 Dec 2023 by Member 12857222
When I moved ASP.NET MVC5 project folder from "D:\EAMser\EAMser\EAMser" to "E:\EAMser", the views are not properly linked with their respective controllers. When i compile the page, the URL generated is incorrect, such as...
17 Nov 2023 by Member 16142785
To send HTML table rows to an MVC controller for saving in a database, you can use JavaScript/jQuery to gather the data from the HTML table and send it to the controller using an AJAX request. Here's a basic example of how you can achieve this: ...
17 Nov 2023 by M Imran Ansari
I believe you should attempt it by yourself and then share any challenges you encounter by posting a question about them. You can achieve this task using AJAX POST method call, generate an array of objects and transfer the table rows to the...
17 Nov 2023 by Moaz mohammed 2021
@model System.Data.DataTable @{ ViewData["Title"] = "Index1"; } Print Save
7 Nov 2023 by Maciej Los
Quick research on Google: Quote: Multiple form field elements in the same form have the same id attribute value. This might prevent the browser from correctly autofilling the form. To fix this issue, use unique id attribute values for each form...
6 Nov 2023 by akhter86
I tried below,but it is not updating into database from webgrid dropdown What I have tried: @model IEnumerable @{ Layout = null; WebGrid webGrid = new WebGrid(source: Model, canPage: true, canSort:...
24 Oct 2023 by ahmed_sa
I work on ASP.NET MVC Project. I face issue action ApprovalIndex Not redirect to action PendingManagersRequests although no error happens. I debug and trace breakpoint until I reach action PendingManagersRequests and trace until I reach to view...
12 Oct 2023 by ahmed_sa
I work on ASP.NET MVC app. I am facing an issue. I can't add text input filter on top of every column to filter. With another meaning, I have a datatable that has 3 columns, RequestNo, EmpId and EmpName. So I will add 3 input box filters for...
11 Oct 2023 by Richard Deeming
Oh look: another day, another zero-effort "do my work for me" question from our resident help vampire. It's not like 30 seconds in Google would yield an exact example of what you're trying to do[^], is it? 🤦‍♂️ But why bother learning, or...
1 Oct 2023 by Mansoordp
I have a small project which is developed on ASP.NET MVC with Angular. I am stuck in when I am uploading the build on IIS, but Angular is running fine on the development environment. Please help me. When the project is run on server, it gives me...
30 Sep 2023 by Dave Kreskowiak
I don't do angular, but a couple of quick Google searches comes up with some hints. The "$injector:modulerr" mean a module failed to load for some reason. The next one, "$injector:unpr" means "unknown provider", probably because a dependency...
14 Sep 2023 by Member 14965952
I have a problem after uploading the ASP Dot MVC Project on server. It works fine on local, but if I upload the build on server, Angular gives an error. Using AngularJS v1.8.2, libraries are angular.js and angular-route.js. I tried many...
13 Sep 2023 by ahmed_sa
What events does an fire when its value is changed ? I working on a .NET application ASP.NET MVC. I am using input text numbers that have up and down arrows. up increase and down decrease Which event fires when pressed...
13 Sep 2023 by Eddy Sels 2021
This is my code that works fine. When I try to initialize the var outside the if statement, the for loop gives all sorts of errors dependant on the way in which the var is initialized: [HttpPost] public FileResult ExportToCSV(string?...
5 Sep 2023 by Eddy Sels 2021
Creating a class did it. thanks to Andre Oosthuizen. So I created an interface and a class ExportData. There are still some things I don't understand and why it has to be done the way it is.The error messages from VS and the docs from MS were not...
3 Sep 2023 by Andre Oosthuizen
When you are initializing the 'Data' variable outside of the 'if' statement, it can cause issues because it depends on '_context' and other variables that are specific to your 'NTK' branch. Using the below code you are making sure that 'Data'...
29 Aug 2023 by OriginalGriff
We've been discussing you: Can we have a "Help Vampire" icon?[^] It's a difficult one to describe ... In this specific case, I think what annoys me (and probably others) is the way he is using us to keep his job, to get paid without actually...
29 Aug 2023 by ahmed_sa
I get an error on auto complete as below. So how to solve this issue so can't modify? jquery-1.5.min.js:16 Uncaught TypeError: Cannot read properties of undefined (reading 'length') at Function.each (jquery-1.5.min.js:16:10613) at...
23 Aug 2023 by Richard Deeming
Quote: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4
16 Jul 2023 by ahmed_sa
I work on asp.net mvc I face issue selected value All requests cleared after display result data and back to Pending Request so my issue on selected value option if i select option All requests it display all requests success but drop down...
6 Jul 2023 by Andre Oosthuizen
You can pass the value as a query parameter in the form submission. a Step-by-step can be followed at - How to pass parameters to action methods in ASP.NET Core MVC[^] Create a C# function that will hold, request and redirect the address value -...
6 Jul 2023 by ahmed_sa
I work on an ASP.NET Core razor page. I need to retain value of address on the page after submit, because I check value of Address after submit - it is not retained, and becomes null. I need to retain the value of the Address without resetting,...
27 Jun 2023 by Akshay malvankar
I have one datable consist around 25000 record datable look like this Id Name Lname bday 1 abc hdhd 25-02-1991 2 cnd dhdhd 7-05-1995 3 dhdhd ddjd 15-07-1993 4 dhhdd ddddhd 05-09-1999 i am converting above...
27 Jun 2023 by OriginalGriff
This is your 49th question, pretty much all of which can be answered with a trivial google, or a little knowledge of the classes you are playing with. In this case, it's simple to work out what you need to do by thinking about a DataTable and...
21 Jun 2023 by Akshay malvankar
I am getting 504 gatewaytimeout error on server after upload 3.92 MB files but record get inserted into table successfully i have 1 webserver and 1 appserver on Webserver: - i am reading excel file and convert it into datable and save excel ...
21 Jun 2023 by Richard MacCutchan
This is the same question that you posted yesterday at 504 gateway timeout error while uploading file in ASP.NET[^]. Please do not repost. If you have additional information then please use the Improve question link in your original post, and...
21 Jun 2023 by Richard Deeming
The maximum request length has no bearing on a timeout error. If you try to upload a file that's too large, you'll get a 404 error, not a timeout error. Quote: I am reading excel file and convert it into datable and save excel into another...
18 Jun 2023 by Akshay malvankar
Hi I try to upload file of 4Mb after click on upload button it give me below error Error : Application Error: Sorry page, you are looking for is not found in asp.net mvc i have written no validation code that will check size of file ,but it...
18 Jun 2023 by Richard Deeming
In IIS, the maximum request size is 4Mb. If you try to upload a file one byte larger, you will get a 404 error. You need to modify the request limits to allow for larger file uploads. That means modifying your web.config file in two places: ...
17 Jun 2023 by OriginalGriff
The error message you are getting is a 404 error: page not found. That has nothing to do with the code you show, it means that the page the user (or a redirect) is trying to access has an incorrect URL and cannot be located. I'd start by looking...
13 Jun 2023 by Graeme_Grant
It is unusual to see a success and error result returned using the same property name in a JSON result. This does not mean that it can not be handled. You have tagged your question with ASP.NET5, so I am going to focus on a .Net 5.0+ solution,...
13 Jun 2023 by Akshay malvankar
i get following 2 reponse from 1 API Call 1) { "id": 200, "msg": "Successful", "trans_id": "415", "info": { "id": "41", "number": "3889 is already exists" } } 2) { "id": 400, "msg": "Bad Request",...
13 Jun 2023 by OriginalGriff
You can't: the two JSON data contain different schema: one requires a collection: { "id": 400, "msg": "Bad Request", "trans_id": "CLIENTAPI202306050146459", "info": [ "state : value must be a valid string", "city...
9 Jun 2023 by ahmed_sa
I work on asp.net razor page model . i face issue i can't edit data table on same page by edit cell without redirect to another page I need to edit cell on same page I need to edit data on table by edit every cell on rows my code details...
6 May 2023 by OriginalGriff
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself. Let me just explain what the error means: You have tried to use a variable, property, or a...
6 May 2023 by ahmed_sa
I working on MVC razor pages asp.net core 7 . I can't display success message after submit and insert data on same page . I get error System.NullReferenceException: 'Object reference not set to an instance of an object.' error happen on...
6 May 2023 by ahmed_sa
I working on MVC razor page with .NET core 7 .I face issue Ajax request not return branches drop down list based on selected value from drop down list country . with another meaning I need cascade branch drop down list based on country drop down...
4 May 2023 by ahmed_sa
I worked on asp.net mvc razor pages . I face issue I can't pass data from page model to view What I have tried: what i try 1- I create view model as public class AddUserViewModel { public int SelectedBranchId { get; set;...
4 May 2023 by mtoha
As far as I know, razor mvc have some HTML function helper. Check this post, and follow instruction. You do not need using foreach. you can use ViewData['listOfBranch'] containing data of branches 81 data at your case. usage to show select...
17 Mar 2023 by Thiru Senthil
Please follow the link https://stackoverflow.com/questions/14773148/how-to-encrypt-the-query-string-id-in-mvc-4-actionlink[^]
23 Feb 2023 by Hania Anum
Hello Guys I am quite new to linq and .net core. I am trying to calculate the next tax return date of a company as a part of my final year’s project. If there is a newly made company with no tax has been made yet (means no entry in the tax...
19 Feb 2023 by ahmed_sa
I working on dot net core app . I have application already publish and deploy on iis so i make change on c# code only so how to transfer changes only are taking only bin folder from published then transfer it to iis or what What I have tried: ...
19 Feb 2023 by Richard Deeming
Publish an ASP.NET Core app to IIS | Microsoft Learn[^]
8 Feb 2023 by Pravin B Webplat
How to get number of rows in a table without using count function? I Am use Count but its get too much time to load data so what is another way to load data without count..I am use count because find all user which one already assign services or...
8 Feb 2023 by raddevus
I don't think it is getting the count that is slowing you down. I believe it is the for loop. Comment out the for loop and try again. public IActionResult Index() { List seruser = new...
8 Feb 2023 by Dave Kreskowiak
It's not the call to .Count that's slowing it down. You've got two lines that appear to be loading entire tables, users and Services, then you iterate over the both both tables, the Services table every single time you look at the next user in...
6 Feb 2023 by ahmed_sa
How to load data employee on view GetAllEmpDetails.cshtml based on drop down selected index changed? I work on MVC web application using c# by ado.net I face issue I can't display employee data based on drop down selected index changed . so ...
6 Feb 2023 by Richard Deeming
Split up your views: GetAllEmpDetails.cshtml @model IEnumerable @{ ViewBag.Title = "GetAllEmpDetails"; } GetAllEmpDetails
2 Feb 2023 by Akshay malvankar
I stored images in database in base_64 format. Fetching that data from a controller to html using Ajax. While fetching record from in controller, I get the following error in custom filter exception: Error during serialization or deserialization...
2 Feb 2023 by Dave Kreskowiak
First, storing images in the database as anything other than binary is just going to make the image data quite a bit larger than if you just stored the bytes in a binary field, especially using base-64 encoding. Next, wrapping all that in a json...
21 Dec 2022 by verma.vivek
I have successfully export data in excel file. I want hide one column in excel? And for one column I need to manupulated data from code side to before export? So basically if I will get data in variable for that column I can do. but i didn't get...
21 Dec 2022 by verma.vivek
as i told export to excel is fine, but want to hide few column(s).
21 Dec 2022 by Richard Deeming
You are not exporting an Excel file; you are sending an HTML table back to the client, and "lying" about the content type to trick the browser into opening it in Excel. Excel will display a warning that the file is "corrupt", and will then...
7 Dec 2022 by Randomuser787
I'm working in mvc 5 entity framework SO im having 3 filters in index view with foreach loop getting items from database and displaying through viewbags to checkbox. After selecting check box and submitting i couldn't keep the selected items...
1 Dec 2022 by User-8621695
Hi Experts, I've created around 10 MVC projects (different solutions) for a single web application. I did it too keep code simple and separated. Now I am trying to run these as a single web application. Like from Login->Menu->Student. Please...
1 Dec 2022 by Richard Deeming
You can use class libraries for models, controllers, services, and views. It's fairly trivial to do in ASP.NET Core: Share controllers, views, Razor Pages and more with Application Parts in ASP.NET Core | Microsoft Learn[^] In MVC5, it's...
1 Dec 2022 by ahmed_sa
I work on web application asp.net mvc core .net 5 i can't modify action login to accept 3 login attempt failed only . if he try with wrong password or wrong email account after that then block it . so how to using session to allow user enter...
1 Dec 2022 by Richard Deeming
Configure ASP.NET Core Identity | Microsoft Learn[^] The documentation clearly describes how to enable, configure, and use the lockout feature.
24 Nov 2022 by Akshay
We want to figure it out, when the user is using the application within the network/domain then the application will auto-authenticate and redirect to the dashboard otherwise if the user is using the application from an outside domain application...
23 Nov 2022 by 2011999
Payroll is Main Menu. and New Pay and Payment records of Sub menus. Payroll New Pay Payment Records When i am Click Payroll. not show the submenu's How can i get the Payroll of the submenus. What I have tried: ...
15 Nov 2022 by Shaik Hussain 2022
Here is the controller code i was trying for 2 different filters.! methods for filters mvc these filters are for getting gender of a student and also level he is studying in. Code below can get only 1 filter at a time from a table students . ...
7 Nov 2022 by Randomuser787
Can anyone share open source codes of school management system. What I have tried: Looking for image insertion of student and view in index as in e-commerce site with all students existing. If not all the code just the image part can help with...
7 Nov 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
25 Oct 2022 by Member 10740412
I am having this exception... can anyone please help to remove it.... Doing my task in asp.net mvcHere is my codeCreate View.....@model SampleWeb.Models.CreateUser@{ ViewBag.Title = "Create";}Create@using (Html.BeginForm()) { ...
24 Oct 2022 by GuinnessNH
Add this line beforehand (use the Commercial enum if Commercial). ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
24 Oct 2022 by Member 14061262
I am using below code to read SharePoint excel file using EPPLUS var webRequest = HttpWebRequest.Create("SharepointURLPath") as HttpWebRequest; webRequest.UserAgent = @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)...
19 Oct 2022 by Ravi-from-India
I have projects A (web application) and B (Class library). Project B is added as a reference to project A. Now, Project B contains some NuGet packages. On my machine, when I run project A it is working fine without any errors. But when the...
21 Sep 2022 by prakash00060
I have to post image to the linkedin from my asp.net mvc applicaiton. What I have tried: Quote: function ShareLinkedIn() { var Array = $('#VacancyGrid [name=id]:checked').map(function() { return $(this).val(); ...
21 Sep 2022 by Fredeirk Van Lierde
There is a great NuGet Packages available + find code samples here Super Easy Way to Automate Posting on LinkedIn with .Net - CodeHelper[^] Quick explanation 1. You create your LinkedInHelper by giving your access token 2. Execute the...
15 Sep 2022 by swathi p 2022
i am getting below issue when i ran scheduler in server. but when i run same scheduler in different server it worked.. Not sure why its giving below error only in one server. Can anyone please help.
14 Sep 2022 by Akshay malvankar
Can anyone explain me what is advantage of writing some logic in Class Library file (.BLL) then writing same logic in model class in asp.net MVC. What is advantage of using class library file (.BLL) in asp.net MVC project Please explain with...
12 Sep 2022 by Manojkumar-dll
I want to generate data from datatable but the date column gives me 2022-09-08T18:05:09.0541780+05:30 i want in YYYY-MM-DD HH:mm:ss format need help TIA What I have tried: { "sDefaultContent": "", "data":...
12 Sep 2022 by OriginalGriff
You are assuming that your data contains a Date value enclosed in parentheses: (2022-09-08T18:05:09.0541780+05:30) which is not what you say teh table contains. Either the table contains the date as a string - which is a very bad idea and...
12 Sep 2022 by Alexander Angelopoulos
11 Sep 2022 by Randomuser787
System.Net.Mail.SmtpException HResult=0x80131500 Message=Failure sending mail. Source=studentlog StackTrace: at studentlog.Controllers.StudentController.Sendmail(MailMessage mail) in...
11 Sep 2022 by Dave Kreskowiak
Are you sure that SMTP host name is correct, "smtp.gamil.com"?
25 Aug 2022 by Randomuser787
I have created session and also tables in db i just wanna store who creates or manipulates the data when a user logged in. when a user exists then from the log in -session it takes username and should store in the table at createdby how can i...
31 Jul 2022 by ahmed_sa
==========Problem========== Cannot add functions to Next previous last first for create action using repository pattern based on EmployeeId field ==========Example========== Employee Id : 5 as last record IF create action view get loaded it must show max+1 for Employee Id meaning it will...
22 Jul 2022 by Member 15341738
Hello, when I am trying to access one of the views in my ASP .NET MVC app I am getting following error: AmbiguousMatchException: The request matched multiple endpoints. Matches: RockWorld.Web.Controllers.Admin.PageParametersController.Index...
22 Jul 2022 by Richard Deeming
A GET request to /Admin/PageParameters/ matches both your Index and OperationProgress actions. You need to change either the method or the route for the OperationProgress action. For example, if you add: [HttpGet("[action]") public...
15 Jul 2022 by Akshay malvankar
I just want to use a singleton design pattern in my asp.net MVC project, I don't know where and in which case is more suitable to used can anyone give me 1 or 2 examples where I can used a singleton design pattern in my project with an example ...
15 Jul 2022 by Richard MacCutchan
You are trying to work it the wrong way round. You need to examine your design to see where a singleton pattern might be useful, not try to fit the design to the pattern. See Singleton pattern - Wikipedia[^].
15 Jul 2022 by Graeme_Grant
I can't see what html is being rendered, so it makes it difficult to see the full picture of what is happening. At a guess, the header/navbar is using class app / position: absolute;. Your Content container element has margin-top: 0;, electively...
15 Jul 2022 by Member 15341738
Hello, I am now working on a .NET MVC app and have a problem with my partial view. It renders within main view, but the top of the partial view which I mentioned before is being cut at the top. Here are pictures: This is how it looks now This is...
7 Jul 2022 by Member 15418280
We are using task scheduler to trigger event in a specific time and it is calling one api method which host in iis at the time of creation task scheduler we are sending userid and password but every month password is going to be change due to...
7 Jul 2022 by OriginalGriff
If the API requires a password to be given when your app accesses it, then it doesn't matter if the app is run through the task scheduler or not: if the remote software changes the password then the app needs to be updated in some way to reflect...
1 Jul 2022 by Member 10738936
This issue comes on live server. In local IIS its working. for deserialize i am uing var data = JsonConvert.DeserializeObject(response.Content); this is my json: {"Table":[{"OrganisationID":1001,"NAME":"LORD MEHER INTER...
21 Jun 2022 by Akshay malvankar
i want to download asp.net mvc project for study purpose,anyone knows where i can download project source code for free What I have tried: i searched it on google but i didnt get free download project
21 Jun 2022 by OriginalGriff
There is no such thing as "asp.net mvc project for study purpose" - that is just a generic name, like "app" covers all the software in Google Play and the Apple store. You need to be a lot more specific about what you want the project to do...
12 May 2022 by Manojkumar-dll
I have to Bind the datas from a Column in datatable into a custom search dropdown using jquery What I have tried: This is the HTML Part
12 May 2022 by Richard Deeming
So many things wrong with that code... Your element has an ID of ddl_type, but your script tries to reference an element with the ID ddltype. Those are two completely different IDs. You declare an array variable called $duplicate, but...
10 May 2022 by Dave Kreskowiak
If your site is dependent on those databases, you have no choice but to connect via the VPN to get at them. This is question more for your company IT about your VPN issues than anyone else.
10 May 2022 by Member 14806991
Hello, in my current job, we have all the databases on the company network and I connect to the company network through Cisco anywhere connect but my problem is the VPN connection is not stable and usually disconnects. I have a deadline coming...
5 May 2022 by Majid Farhan
Projcet in MVC & VB.net This is the full error message: System.Data.Entity.Core.ProviderIncompatibleException: 'An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection...