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

MVC

MVC

Great Reads

by Ajcek84
Open source library for music engraving in desktop, mobile and web applications
by Vahid_N
PdfReport is a code-first reporting engine which is built on top of the iTextSharp and EPPlus libraries.
by John Atten
Add Basic Group-Based permissions management to your ASP.NET MVC application. For applications of moderate complexity, which require a little more granularity in authorization permissions, but which may not warrant moving to a heavy-weight solutions such as Active Directory.
by Jovan Popovic(MSFT)
Reordering table rows using drag and drop functionality with jQuery DataTables plug-in in ASP.NET MVC applications

Latest Articles

by Coding Notes
In Part 4, we added basic support for the shopping cart, and now we'll enhance and refine that functionality.
by Mark Pelf
A practical guide to building a multi-language ASP.NET 8 MVC application
by Mark Pelf
A practical guide to build a multi-language ASP.NET 8 MVC application
by Mark Pelf
How to build a multi-language ASP.NET 8 MVC application

All Articles

Sort by Title

MVC 

21 Jan 2015 by teledexterus
I am a little confused about the IEnumerator in this case. Does it accurately depict List?The error is in the "foreach" statement only the "foreach" is red underlined not the "item" or the "Model". It says it "...does not contain a public definition for...
21 Jan 2015 by Sergey Alexandrovich Kryukov
It clearly tells you that the object Model cannot be used as a set of object for using in foreach. This is simple: the type of such object should support System.Collections.IEnumerable:https://msdn.microsoft.com/en-us/library/system.collections.ienumerable%28v=vs.110%29.aspx[^].Pay...
19 Apr 2013 by Necmettin Demir
"How to series" about MVC, jQuery, JSON, paging, mapRoute.
22 Sep 2015 by Nayan Rudani
Hello Freinds,I have created asp.net mvc application to implement html to pdf functionality. Converting and downloading html to pdf is working fine on locally. But when i publish it on azure then it dosen't work. I have got an error like 'Invalid directory name'.Can somebody please...
20 Feb 2016 by Abrar Kazi
"return Json(true,JsonRequestBehavior.AllowGet)" returns 'true' on screen instead of calling Onsuccess MethodI am calling Action method from Ajax.BeginForm("ActionMethod",new AjaxOptions{OnSuccess="MyScript",HTTPMethod="POST",OnFailure="MyScript2"})What I have tried:I tried...
15 Feb 2016 by Manas_Kumar
Follow below steps to implement AJAX.BeginForm in MVCStep1: Enable Unobustrive in web.config Step2: Add following code in your view page(*.cshtml)@using (Ajax.BeginForm("PerformAction", new AjaxOptions { OnSuccess = "OnSuccess", HttpMethod="POST", OnFailure =...
19 Oct 2015 by viprat
Hello,I am new in MVC Angular JS.I have create one application and defined $locationProvider.html5Mode(false) in Rounteconfig.js file.If i change it to true, then page in going in infinite loop and after some time its crashed.Any one help me why its going in infinite when i set to true.
21 Jun 2017 by JatinKhimani
I know that is this question has dozen of answers and posts, but nothing works for me. We have my MVC4 application and i deployed it to IIS7 to my server and one more machine where we don't have visual studio installed. We are doing import/export data from/to excel for doing bulk entry. we do...
16 Mar 2014 by Member 10506553
I have an error in my partial view : Object reference not set to an instance of an object which I tried to bybpass by adding this line but it seems not working because I got the previous mentionned error.If I put a break point on the added line (@if (Model.CartItems != null)), the first...
16 Mar 2014 by Sergey Alexandrovich Kryukov
If, as you say it yourself, Model is null in some cases, you should also check if (Model != null) … what you do in this situation really depends on what you want to achieve. You cannot ask more and more questions like that each time similar situations take place; they are way too typical....
16 Mar 2014 by coder771
Try out something like this @{ var cartCnt = 0; if (Session != null && Session["CartCount"] != null) { cartCnt =...
15 Dec 2014 by Member 11313883
*hi there .i have a question about sync the contact of the lync to an other software?
17 Oct 2017 by Navin Ranjan
I have an ASP.NET MVC application hosted in web server with URL http://10.26.14.99/projectA i.e. environment1 and same application is hosted in another web server with URL https://projectA.test.com i.e. environment2. Now, for environment1 when I enter...
17 Oct 2017 by OriginalGriff
What did you expect? http://10.26.14.99/projectA/../../../../test In a path, ".." is a relative folder specifier: it says "folder above". So you are asking for root / projectA / folder above (giving root) / folder above root / folder above that / folder above that / test You cannot use a...
8 Jul 2013 by Liviu Ignat
MVC 3 plugin architecture with embedded razor views: steb-by-step description and demo application.
3 Oct 2016 by Saineshwar Bageri
In this article, we are going learn to create an application that works online and offline.
8 Jul 2013 by Liviu Ignat
How to handle database operations or any kind of business specific logic inside plugin assemblies.
2 Jan 2021 by TheBigBearNow
Hello all, I currently have 2 separate projects, I have an API for the backend with CRUD and login functionality, I also set up Json Web Tokens on the backend for validation purposes. I have a front end MVC project which I am using for my UI. On...
18 Jan 2017 by Bart-Jan Brouwer
.Net Core datagrid with server side paging, sorting and filtering
30 Apr 2018 by Member 13731370
I have 6 Projects in a solution. I can't access other projects folders from my Web Api Project. there is no problem for others. What should I do? What I have tried: I create a dependency from Web Api Project to Class Library Project and other Web Project. I haven't done circular dependency....
30 Apr 2018 by Member 13731370
Solved - Right click on Project and select Add → Reference → select the project you want to reference.
21 Mar 2019 by Member 8741848
I'm trying to thin down my Controllers, by using a service layer. But I can not workout or find an example of how to handle issues that arise in the service layer. As an example, I have a controller action Add Item, which has a name and user defined ID. The code must be unique in the database....
21 Mar 2019 by F-ES Sitecore
It's generally done by return types. Either return false from your Add method if it didn't work and show a generic message to the user, or return an enum with values like "Succeeded", "DuplicateID", "InvalidData" etc to specify the specific reason for failure and the controller will then show a...
6 May 2015 by Etienne Louise (974)
In this article I'll show how to create custom culture and then show an exemple of how to use it in an ASP.Net MVC application.
31 May 2016 by Yaseer Mumtaz
.NET interview questions and answers with real world examples and code snippets
12 May 2014 by Brad Joss
[RegSave] your property to the Registry, and more.
24 Mar 2023 by robertotelles00
Dan Good afternoon My name is Roberto Telles ([EMAIL REMOVED]). I wonder if the HTML5 Event/Calendar Scheduler is still supported in the .NET MVC framework. Would it be an old version of this component? Thank you very much in advance. Yours...
24 Mar 2023 by Richard MacCutchan
Who is Dan? If this message is in reference to a CodeProject article then you should use the forum at the end of the article.
7 Oct 2016 by Andrew Blank
Better ways to create a .NET MVC Single Page application
1 Feb 2014 by CoderPanda
I am trying to make a 'build/buy/use opensource' decision on a rule engine for the Computerized physician order entry (CPOE) module within the EMR/EHR application which is .net based. We are trying to do this to be Meaningful Use (MU 2014) compliant.I am totally new to the healthcare domain...
20 Mar 2014 by Norman Paterson
Hi, yes I've evaluated rules engines after using the .Net 3.5 engine, and although the rules editor has a lot to be desired, especially because it's a sample project, I find the Microsoft provided rules engine is the best. A lot simpler than Inrule, which has better looking editors but is more...
11 Mar 2013 by AssemblySoft
A trivial business logic layer from scratch with a TDD approach.
7 Jun 2019 by ThahirAhmed
I need to create a web application like a shopping site using .Net Technology like ASP.NET, ASP.NET MVC, ASP.NET Core or ASP.NET Razor. Which technology is comfortable? What I have tried: I have knowledge in C sharp language with ASP.NET, ASP.NET MVC, ASP.NET Core or ASP.NET Razor. I need to...
7 Jun 2019 by RickZeeland
Take a look at the open source nopCommerce package, it's written in ASP.NET: open-source-e-commerce-platforms[^]
1 Apr 2014 by senthilmonster
Please let me know , Which are the .Net Framework versions ASP.Net AntiforgeryToken Salt introduced and obsolete?
1 Apr 2014 by Abhinav S
This method was available in .Net 4.0.It is now obsolete - 4.5 and above.MSDN[^].
15 Nov 2023 by irfan.programmerspost
Hi, I want to work on mvc .net project but I do not know should i use .netframe work or .net core. My new project will be customer management system and it will use Sql Server at back end. Please give me some hints which plate form to choose? ...
15 Nov 2023 by Graeme_Grant
There are many of reasons to go .Net Core. Some of the key benefits are: * Highly optimised without the legacy support that .Net Framework suffers from * Highly performant * multi OS support * minimal API support * Blazor support * .Net Framework...
28 Jul 2015 by Member 11854679
if ($.cookie("style") != null) { var savedStyle = $.cookie("style"); $('#theme-style').attr("href", "assets/css/theme/" + savedStyle + ".css");};jQuery(document).ready(function() { if ($.cookie("style") != null) { $("#theme a").attr("class", ""); var currentStyle...
28 Jul 2015 by Suvendu Shekhar Giri
Make sure that you have added jQuery.Cookie to the script bundle. "~/Scripts/jquery.cookie.*"If not get it from hereNuGet | jQuery Cookie 1.4.0 [^]Hope, it helps :)
22 Jul 2015 by Shmuel Zang
It's seems like there is no definition for the imagepreview function in your JavaScript's code.
5 Sep 2018 by Saineshwar Bageri
How to secure ASP.NET Core MVC Applications against top 10 attacks
4 Aug 2016 by Saineshwar Bageri
In this article, we will run through 10 points which will help us to make our MVC code secure.
26 Jun 2016 by VijayRana
10 ways to Bind Multiple Models on a View in MVC
1 Apr 2015 by Member 10285969
Please bear with me because my type understand more from example and no example online are specific to the target.Please, if its possible i can give you my email(any programmer), please and please help me develop a small application. Its simple to you: add a galleries entity and add some...
1 Apr 2015 by Dave Kreskowiak
Yeah, nobody is going to give you their email address.Giving you an app that you can run is not really going to help you.Your best bet is to pick up a book on ASP.NET MVC and work through it.
1 Apr 2015 by King Fisher
Start your learning herehttps://www.youtube.com/watch?v=-pzwRwYlXMw&list=PL6n9fhu94yhVm6S8I2xd6nYz2ZORd7X2v[^]Just 100 clips .i think you can create your own application once you done this clips.All the best
1 Apr 2015 by Peter Leow
If you want to survive in this line, self-learn and self-actualisation are the must-haves. Bear in mind that1. No one owes anyone a living.2. Rome was not built in one day.Your journey starts here => http://www.asp.net/mvc/overview/getting-started/introduction/getting-started[^]
25 Jul 2014 by Imran Abdul Ghani
Here are 2 simple ways to create Custom HTML Helper in ASP.NET MVC
25 Mar 2016 by Member 10740412
i am using cascading dropdownlist in asp.net mvc. when value is selected from first dropdown, the list is shown in 2nd dropdown but when i select the value from 2nd dropdown it shows in the dropdown but after clicking the submit button it disappears showing "Select from List". Please can someone...
20 Jan 2014 by Member 10515145
Hi,I am learning mvc4 using 3 tier architecture . I am creating a simple application with visual studio 2012 and sql server 2012.I have created a project add in this project i have added two more project which are DAL (data access layer) & BLL (business logic layer). now i am confused...
20 Jan 2014 by Christian Graus
The presentation layer is your MVC project. MVC includes models and viewmodels, which can make this sort of thing confused. In theory, your business layer handles all the business logic, and the database handles getting data from the DB and storing it there.I'm not sure how far I'd go with...
31 Oct 2013 by Rahul Krishnan R
Hi,I am planning on making a dot net web application with database in SQL Server.I have heard about 3-Tier Architecture and MVC. Which is more appropriate to create an enterprise web application. Requesting your valuable suggestions.Thanks in advance
31 Oct 2013 by Pratik Bhuva
Well Rahul its totally depend on Your requirements.If You Project Cost is low then i will suggest you to use Asp.Net Web Froms.Generally we should prefer it in RAD development when we don't need very long term maintanence or greater future changes.And if the cost is not an issue and your...
31 Oct 2013 by E.F. Nijboer
3-tier and mvc are two totally different things. You might get fooled by the fact that they both separate concerns but on a completely different level. The mvc works on application level where a 3-tier architecture is on enterprise level. Your mvc web application is simply at application level...
5 Feb 2024 by Rilwan Opeyemi
Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the...
5 Feb 2024 by Richard Deeming
The default route is /[Controller]/[Action]. Therefore, for /Home/Read, you would have an action called Read on a controller called HomeController. Your controller is called ViewBagViewController. Therefore, your URL should be /ViewBagView/Read...
24 Sep 2013 by ashok yede201
Hello,I am using third party Fileupload control to upload file by ajax call in mvc4.It works fine on local, but when I uploads website on IIS 7, it gives error 404 Not found.It searches for http:IpAddress:PortNumber/api/upload which is missing Virtual directory name from ajax call.My...
13 Oct 2014 by Ranjeet Patel
Hi I have a problem with my website. When I click it gives me the subjected error(404 unable to find directory or file Error in ASP).ex: My website name is http://ABC.com and there is a link on page http://ABC.com/A.aspxWhen I click it it goes to http://ABC.Com/B_Folder/B.aspx link then...
14 Oct 2014 by Shweta N Mishra
Have you created the virtual directory for B_Folder.Another way is to get the folders placed in Inetpub/wwwroot folder , wwwroot is the default directory for websites. earlier versions of windows have this automatically created in c drive. for older version you would have to install the IIS...
14 Oct 2014 by Ranjeet Patel
I have managed to solve it by giving the permission to IUSER the B_Folder was not accessible to the IUSR,so I gave full permission to this user and other users.But still searching why this IUSR needs permissions.
21 Aug 2014 by soumyaraj
We are getting a 500 error. please help me See below:HTTP/1.1 500 Internal Server ErrorCache-Control: privateContent-Type: text/html; charset=utf-8Server: Microsoft-IIS/7.5X-AspNet-Version: 4.0.30319X-Powered-By: ASP.NETDate: Thu, 21 Aug 2014 09:19:44 GMTContent-Length:...
22 Aug 2014 by David Lee 145
I think that this error is caused by submitting input value with html tags.In your controller, you can use ValidationInputAttribute on your action.[HttpPost][ValidateInput(false)]public ActionResult Index(string text){ return View();}In your model, you can use...
2 Jul 2018 by Sambolite
When I run the application I Encounter this error :Unable to start debbugging on the web server. The remote server returned an error:(503) Server unavailable. What I have tried: Tried to restart IIS,Application pool
2 Jul 2018 by OriginalGriff
IF you don't understand an error, then google it: Unable to start debbugging on the web server. The remote server returned an error:(503) Server unavailable. - Google Search[^] Follow a few links and if they don't fix it, then at least they give you some ideas to try, and some idea of what isn't...
6 Jan 2019 by Member 14110143
The Site is showing the 504 gate way timeout error frequently. Because the CPU utilization was reached maximum. We have used AWS RDS, Hibernate, MySQL, Spring MVC in our application. Unable to find the reason for maximum CPU utilization. Please help me out on this issue. What I have tried: ...
6 Jan 2019 by Richard MacCutchan
This is an impossible question to answer. You need to gather more information from your system. [edit] Reposting the same question is not going to change the answer. [/edit]
6 Jan 2019 by OriginalGriff
When you asked this question an hour ago: Maximum cpu utilization[^] I told you we can't help you. That hasn't changed, even if you wish it had ...
6 Jan 2019 by Patrice T
Reposting same unanswerable question half an hour later will not improve answers. Maximum cpu utilization[^] The host admin is probably the only one able to give you useful hints.
14 Sep 2014 by Mihir_Naik
Description: When i post form with two count of puchaseordertax, i will found that but if i post with only one record (Count) it did'nt![Note:Uid is working s index and Correctly! ]My Model:class PurchaseOrder{int PurchaseOrderID {get;set;}datetime PurchaseOrderDate {get;set;}public...
29 Aug 2019 by Member 12132704
Hi I'm getting a scary problem The controller is invoked normally, the foreach loop works fine, call the view with a List return and the @foreach start the loop and load the registers brought from the DB, but in the last interaction it brokes. Server Error in Application '/'. Object reference...
29 Aug 2019 by jimmson
You need to debug your code and find out which property is set to NULL. That is something nobody can do for you, as we don't have any access to your data. By last "interaction" I guess you meant iteration - so I suspect the last item in Model have some property set to NULL while you trying to...
29 Aug 2019 by OriginalGriff
There is no "one solution" - 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 method return value...
29 Aug 2019 by MadMyche
A couple of possibilities here 1. The Model being passed in is NULL 2. One of the properties of the Model.Item is NULL For the first case scenario, what I do is specifically check before I try to iterate through it@if (Model != null) { foreach (var item in Model.Where(item => item != null))...
29 Aug 2019 by Member 12132704
Probably that it must be a property setted as null, why the Model isn't null for sure, I checked debugging and the List has data. I'm using decimal properties and its not Nullable declared, it could be a problem? In Controller a do like this: var items = db.CarrinhoCompras.Where(x =>...
28 Aug 2018 by Member 13944054
in a Razor view... @Html.ActionLink("Cancel", "Index", "Client") @**@ @using (Html.BeginForm("SaveNewClient", "Client", FormMethod.Get)) { . . . Index is action...
28 Aug 2018 by Member 13944054
I don't know if this constitutes a solution but it may help others. I traced the problem to a div.wrapper css section, obtained from a side-navbar solution I found on the Interwebs... div.wrapper { margin: 140px auto; border-radius: 5px; width: 200px; height: auto; float:...
28 Aug 2018 by Member 10371658
make sure that div should not overlap the anchor tag. and make sure you have added Index method in ClientController as Get method. add this, just after the body tag. and try again @Html.ActionLink("Cancel", "Index", "Client")
12 Jan 2015 by Branden Coker
Good morning all. I have a problem that I've tried everything I can think of and searched the net and cannot find a resolution. I have a check box that simply tells the database whether a field is true or not. The data side of this checkbox works perfectly both posting and retrieving...
12 Jan 2015 by Branden Coker
I think I found the solution. Sorry to bother you guys. It appears it is the padding that is messing up the check box. I took the padding out of the markup and it stays fixed.
21 May 2013 by Rei Brazilva
I'm trying to learn ASP.NET MVC4. Some if these concepts are new to me. My question today is:How do I control the amount of rows and cols in a form when I use @Html.TextArea() Here's my code if it helps, but it is a pretty general question ...
21 May 2013 by Dave Kreskowiak
Wouldn't "rows" and "columns" suggest using a HTML table to you??
21 May 2013 by kumar2413
@Html.TextAreaFor(model => model.Description, new { @class = "whatever-class", @cols = 80, @rows = 10 })Try this and see
5 Jan 2016 by Michael Rodrigues
@Html.TextAreaFor(model => model.descricao, htmlAttributes: new { @class = "form-control", @rows= 5, @cols = 30 })
29 Aug 2013 by Tanna Jayesh
I have created a checkbox using textbox in asp.net mvc 4 on view page like this.@Html.TextBox("SomeID", "SomeValue" ,new { type = "Checkbox" })now based on some condition, I would like to check this checkbox.How could it be possible?I have tried @Html.TextBox("SomeID",...
29 Aug 2013 by muneebalikiyani
You should set the AllowRating property to true, preferably in the controller or model.Like other inputs, the checkbox's state reflects the value of the property.
30 Aug 2013 by zj493241838@sina.com
Why not to use @Html.Checkbox()?为何不直接用@Html.Checkbox()
30 Aug 2013 by SPASWIN
by using javaScript/jquery you can Check/Uncheck the checkBox if (//Here Check your Condition) { $("#SomeID").attr('checked', true); }OR@Html.TextBox("SomeID", "someValue" ,new { type = "Checkbox",@checked=true })
4 Sep 2013 by tpkpradeep
set this ViewBag.Checkboxvalein previous action where it comes fromvar ischeck= ='@ViewBag.Checkboxvalue';if(ischeck=="Y"){$("#SomeID").attr('checked', true);}else{$("#SomeID").removeAttr('checked', true);}
3 Aug 2012 by sachinsnsagar
My requriment is to provide 10cm margin to all the page when printing.I'm printing using window.print(). My web page will dynamically increase (so number of pages cannot be determined). For all the pages I need to provide margin of 10 cm.I used CSS Media="Print", within which I defined...
3 Aug 2012 by Sergey Alexandrovich Kryukov
Right. It looks like even though @media itself is supported by Gecko (at least for some properties), @page is not:http://en.wikipedia.org/wiki/CSS_support[^].That's a pity :-(—SA
28 Aug 2013 by velmahesh
:) Pls give some MVC study Materials and Tutorials? :)
28 Aug 2013 by Adarsh chauhan
Hi,visit thesehttp://mvc4beginner.com/Tutorial/[^]Creating a simple application using MVC 4.0[^]PS. Google is our friend.. Google to get more details on MVC
28 Aug 2013 by SagarRS
In the below link I sent your on the right hand side you will find pluralsight videos .. they are very good for a starter to learn MVC try thosehttp://www.asp.net/mvc[^]
11 May 2016 by Member 12512746
Hello! I have a problem with sending objects (as hidden) to the controller for it to operate with them.I have a table that has hyperlinks in its first column's values. I want to call a method which recives the object of that row, but I dont want that user to see the object. How can I achieve...
11 May 2016 by Strikerzz Arut
Hi,I think you can serialize and de-serialize the object to get the desired output.convert an user-defined object to the javascript option using Json.Enocode(Item)Then pass the object to the controller using the ajax function call.
18 May 2014 by Shahriar Hossain
[Attribute] Routing in ASP.NET MVC 5 / WebAPI 2
31 Jan 2013 by Rakesh Agarwal1984
Hi,Please explain what's the difference b/w these 2 statements..1. [authorize(roles="Admin"]2. [authorize(users="Admin"] any help would be appereciated.Thanks in advance