Click here to Skip to main content
15,901,426 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 Ngọc Minh Trần
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 Updated

MVC 

22 Dec 2010 by #realJSOP
Try this:EventType events = (EventType)(db.EventType.SingleOrDefault(f => f.eventTypeID == eventTypeID));
1 Jun 2011 by #realJSOP
Ever heard of google? They provide billions of links every day.Results for "mvc entity framework sample"[^]Look at the very first result of the 535,000 returned...
15 Jul 2011 by #realJSOP
If all of your data will fit in available memory, you could retrieve all of the data you need to display, and then extract only the items that will fit in a page. Psuedo code:0) retrieve data 1) Calculate number of pages you have - Math.Min(1, Math.Floor(records_retrieved /...
11 Aug 2011 by #realJSOP
If you are new to MVC and Linq, maybe you should work on test applications to gain a better understanding of the underlying paradigms before designing an enterprise-level application. In that regard, google is your friend. There are MILLIONS of examples of both Linq and MVC (and the two combined).
12 Apr 2015 by #realJSOP
I'm trying to get the jquery-ui dattimepicker to work in my MVC5 project.I added jqueryui to BundleConfig.cs, like sopublic static void RegisterBundles(BundleCollection bundles){ bundles.Add(new ScriptBundle("~/bundles/jquery" ).Include("~/Scripts/jquery-{version}.js")); ...
14 Oct 2016 by #realJSOP
Protocols, domains, and ports must match. - Google Search[^]
7 Nov 2016 by #realJSOP
Make sure the tabindex value is >= 0.EDIT (for whoever voted my question down) ============His complaint is that "it doesn't work" and supplied NO CODE. That tells us absolutely nothing. If he doesn't want sh*t answers, he shouldn't ask sh*t questions. And that goes for everyone asking...
8 Nov 2016 by #realJSOP
Delete the semi-colon after the curly brace
21 Nov 2016 by #realJSOP
Increase the SqlCommand.Timeout value. I typically just double mine when I run into this issue (however the default value is 30 seconds, and that is typically enough). You could also set it to 0 which indicates no timeout, but that can be dangerous, and lead to an app that hangs.Secondarily,...
16 Oct 2017 by #realJSOP
I'm having a problem getting my head wrapped around EF6. I have the following tables: AspNetUsers (entity provided by MVC) ICSProfile ICSEvent ICSVehicle ICSEventClass ICSEventEntry I want to associate them as follows: 0) A given AspNetUser can have one ICSProfile record. A given profile can...
5 Jan 2018 by #realJSOP
When you have a customized DbContext constructor.
18 Nov 2017 by #realJSOP
One less pesky nuance to worry about
28 Nov 2017 by #realJSOP
ViewBag, ViewBag, three times full...
25 Feb 2018 by #realJSOP
The domain name for your SMTP server is incorrect.
27 Feb 2018 by #realJSOP
Google Search - verify pdf digital signature in mvc[^]
27 Feb 2018 by #realJSOP
I wouldn't worry about maintaining an archive of older files unless that's a specific requirement. If it is, you can establish a max number of old files to maintain to keep disk usage on the file system server to a dull roar. Files can quickly overwhelm available disk space on a busy site. You...
2 Mar 2018 by #realJSOP
If you don't want the ORM to update/insert/delete, simply don't use the methods that do those things, and call your own ADO stuff instead.
8 Mar 2018 by #realJSOP
Put a try/catch block around your code so you can properly debug it. BTW, you don't need the alias "p" if you're not doing a join. I would also add a check to make sure sdr.HasRows is true before trying to access the sdr object, as well as check to make sure the desired column(s) exist within...
9 Mar 2018 by #realJSOP
If I recall correctly, I used the technique described at this link to persist data between requests (the site is blocked at work, but the URL seems familiar): Getting information into the Layout without using ViewBag. – jgauffin's coding den[^]
12 Mar 2018 by #realJSOP
Simply comment out the columns you don't want to display. Yes, it really is that easy.
14 Mar 2018 by #realJSOP
look into the package manager console command update-database
16 Mar 2018 by #realJSOP
First, why are you worried about the index of the item you're editing? Seems weird given the nature of EditFor. Don't do it on the client side. Do it this way: @foreach(var item in Model) { @* if you really need the index, you can do this in a foreach loop *@ int index =...
20 Mar 2018 by #realJSOP
The viewbag is re-initialized with each request. You have to find a different way to persist data between requests. There are several ways you can do this, and which method you use really depends on your requirements. Google is your friend. mvc persist dat between requests - Google Search[^]
21 Mar 2018 by #realJSOP
Have you tried adding application/vnd.qlik.sense.app as a mime type in your web.config file? Something like this: ...
28 Mar 2018 by #realJSOP
You can break your controller code into multiple files (you have to make your controller a partial class). I do this if the controllers are "busy". It helps to keep stuff compartmentalized a little more and you avoid having to scroll past methods that aren't applicable to what you're doing. I...
13 Apr 2018 by #realJSOP
Deserialize your json collection: Deserialize a Collection[^] After that, write a method that converts your deserialized objects into a datatable, and Bob's your uncle. BTW, if you use the netwtonsoft json.net library (a nuget package), you can deserialize directly to a datatable. DataTable...
7 Jul 2018 by #realJSOP
If you have a datatable, you can save it as a xml file using the DataTable.WriteXML() method, and then open that file in excel.
3 Oct 2018 by #realJSOP
If it doesn't have to be a real-time process, you could create an SSIS package to import the uploaded file, create a SQL server job to run the package, schedule that job to run every N minutes, and simply let the user hit refresh on the web site whenever he wants. I know it sounds like a lot of...
11 Oct 2018 by #realJSOP
Well, identifying the goal is halfway to solving the problem. Use intellisense to determine what method/property to use to "show the data". I would give you more guidance, but I don't have any skills regarding mind-reading and other associated technologies.
15 Oct 2018 by #realJSOP
It's a play list file, not a video/audio file. Google will reveal what you need to do, but you can try Banshee Media Player, or maybe HLS-Player. Beyond that, it's not your job to make sure something will work on the client side besides letting the user know what he needs of have installed,...
25 Jan 2019 by #realJSOP
Sharing files between multiple web apps in a single solution.
6 Feb 2019 by #realJSOP
I posted a tip about this a number of years ago: Resolving Paths in a Multi-Folder WebSite[^]
12 Mar 2019 by #realJSOP
That connection string looks like it was generated by EF/ADO Entity (database first). This part looks suspect: Password=######;"MultipleActiveResultSets=True" providerName="System.Data.EntityClient" Try changing it to this: Password=######;" MultipleActiveResultSets="True"...
12 Mar 2019 by #realJSOP
There are 3rd-party libraries available, and even some on NuGet. Google is your friend: Google - "mvc convert web page to pdf"[^]
18 Mar 2019 by #realJSOP
If it were me, I'd find a library that already knows how to parse CSV files, anduse that. Simply splitting eachline on a comma will NOT always get the job done. Furthermore, putting the data into the database with an appropriate datatype is the only way to do it right. I wrote a library that...
27 Mar 2019 by #realJSOP
In your [HTTPPost] SubmitBill method, the callRecords parameter contains the data submitted from the page. After that, how you get it tinto the database depends on how you've implemented your data access layer (which you did not share with us).
2 Apr 2019 by #realJSOP
mvc5 grid - Google Search[^]
7 May 2019 by #realJSOP
This website is blocked where I work, but look here: Shufti Pro API Source Code Samples | ProgrammableWeb[^] BTW, I did a google search to find that link. I heard that google searches were recently made free of charge, so you can do it, too...
22 May 2019 by #realJSOP
I thinkt he only way you can call another app in your solution is to run two instances of visual studio with the same solution loaded, start your api application in the first VS, and then go to the 2nd VS and run your web app. To make things easy on yourself, specify a port number in your api...
18 Jul 2019 by #realJSOP
Google odp.net. You need to bulk copy the data.
31 Jul 2019 by #realJSOP
Make data exchange in MVVM easy on yourself
24 Dec 2019 by #realJSOP
With proper use of CSS, of course. The MVC project template uses Bootstrap for element positioning. However, the topic is so broad that you really need to google it to learn about it.
4 Apr 2020 by #realJSOP
0) Don't post stuff on imgur that can easily be posted here. 1) You can't create json without data in your objects. 2) Your model isn't complete. There is no AtlasTransaction object defined in your example code 3) Why are you serializing it...
31 May 2020 by #realJSOP
Caveat - Your question sucks because you didn't tell us what your actual problem is. Because of that, my proposed solution is can be rightly called a "wild-assed-guess". Proceed as you see fit. I suspect that you're finding that, while you can...
28 Mar 2021 by #realJSOP
The google machine showed me this: Partial Views - ASP.NET MVC Demystified[^] Maybe try using RenderPartial instead? (This is just a stab in the dark)
12 Jul 2021 by #realJSOP
1) You have to establish a maximum file size, and process each file one at a time. You should be able to get the size of the uploaded file somehow before you start transferring data. If the file size is larger than the limit, reject the file and...
5 Nov 2021 by #realJSOP
You could create an object that can have objects added to it. Given the following: public class Model1 { public Model1(){ } } public class Model2 { public Model2(){ } } public class Model3 { public Model3(){ } } public class...
28 Nov 2021 by #realJSOP
See if this doesn't help you. I created a Patient object from the info I could gather from your sample code. The important part are the constructors. // I added a default constructor, and a constructor that accepts a DataRow object. // This...
21 Jun 2022 by #realJSOP
I assume you're using bootstrap, so you have to research how child elements are laid out in bootstrap.
6 Jul 2022 by #realJSOP
When you deploy new javascript code, sometimes you have to clear the browser's cache data in order for it to re-load the .js file. Sometimes, doing a Ctrl-F5 will perform the reload without clearing the cache.
13 Jun 2015 by #realJSOP
I'm real new to this whole MVC thing. I'm doing a web site that has an eCommerce component and was wondering how you integrate the eCommerce code into an existing site. It seems as if every eCommerce solution out there is written under the assumption that it IS the web site. Is that typical?...
29 Jul 2014 by $*Developer - Vaibhav*$
Hi All,I am new for MVC application, just created one MVC application using database first approach (.edmx file).I’ve done insert, update, delete and select functionality but when we insert the new record (firstName) as blank it will throw the error because in table allow null is false,...
14 Oct 2015 by $*Developer - Vaibhav*$
http://stackoverflow.com/questions/6999441/sql-server-2008-stored-procedure-with-multiple-output-parameters[^]
18 Oct 2015 by $*Developer - Vaibhav*$
Hi,Please refer below url : How to convert DataTable to object type List in C#[^]
25 Sep 2013 by $r!dh@r
Hi, Iam new to MVC model application development in .netCan any one explain the application development in MVC2,3,4and please explian the connection sqlserver connection.thanks in advance
29 Apr 2015 by .net bigner
my view code is:-@model MvcApplication6.Models.schooldetails@{ ViewBag.Title = "Home Page";}@section featured { @Model.StudentName ...
18 May 2015 by .net bigner
namespace tableshow.Controllers{ public class TableShowController : Controller { private TableShowEntities db = new TableShowEntities(); public ActionResult show() { ViewBag.TableShowsData = db.TableShows.ToList(); return...
8 Sep 2014 by .net333
Hi Friends, i completed 2 years experience with asp.net,c#,sql server,wcf services with entity framework..Now i want to start learning asp.net mvc programming..please give me simple examples to leann asp.net mvc1) Asp.net mvc using razor engine2) Asp.net mvc using aspx...
9 Sep 2013 by .Net_d19
I use a ckeditor, which wirte text in database in html tags.How can I read it and show as bold text, for example.some text but I getting only html text.
9 Sep 2013 by .Net_d19
I found the solution.Use @Html.Raw(text)
18 Sep 2014 by /\jmot
try thispage_load(){ if(Session["userLogged"]=="") // check for the session { response.redirect("loginpage") }}
21 Oct 2014 by /\jmot
Your Code Working Fine With me..I can't find out why, you are not getting the result..Try different code..I think this will solve your problem.List dropItems, dropItems2; using (var dbContext = new DatabaseContext()){var data = from o in dbContext.locations select new {...
27 Nov 2014 by /\jmot
Video Tutorials..A List here,,https://www.youtube.com/playlist?list=PL33C9E91F8CDD2BF7[^]CP Tutorials, optional(Not Video)http://www.codeproject.com/search.aspx?q=mvc+beginner&doctypeid=1%3b2%3b3%3b13%3b14[^]
14 Dec 2014 by /\jmot
See..http://www.codersrevolution.com/blog/SQL-Server-How-Many-WorkWeek-Days-In-Date-Range[^]
28 Jan 2015 by /\jmot
Ref. Here..http://stackoverflow.com/questions/214500/linq-fluent-and-query-expression-is-there-any-benefits-of-one-over-other[^]http://stackoverflow.com/questions/1182922/what-is-the-efficiency-and-performance-of-linq-and-lambda-expression-in-net[^]
10 Feb 2015 by /\jmot
public class CheckBoxItem{ public string Code { get; set; } public bool IsChecked { get; set; } public string Label {get;set;}}razor: @Html.HiddenFor(x => x.Code) @Html.CheckBoxFor(x => x.IsChecked)@Html.LabelFor(x => x.IsChecked,...
18 Aug 2016 by 09andy
Hi Friends,Currently i am facing problem with socket programming in WCF services for chat application. I have done lot's of R&D on it but not getting successes. So please it is my humble request that if any one have any demo or links related socket programming in WCf services for chat...
23 Jun 2015 by 0bsidian
Hi there,i followed the tutorial on https://github.com/ninject/Ninject.Web.Mvc/wiki/Dependency-injection-for-filtersIt is driving me insane, the service inside the filter is null and won't change to an object instance. I tried property Injection and decorated the interface with the...
20 Nov 2012 by 1castle1
I run MVC4 sites on my local machine with windows xp using IIS 5.1 all I had to do is add the 4.0 framework make sure the virtual directory is targeting the right framework. So I am pretty sure that you can run them in windows server 2003. Your other problemYou you should run your site...
20 Nov 2012 by 1castle1
I'm not sure that I completely understand your question...If some thing is not working when you click something in MVC I normally have a look at the html and see what controller/action you are trying to call and put a break point there so you can see what is happening.And I have to add...
20 Nov 2012 by 1castle1
I wouldn't use a Bool? if you really need to use a Bool? then you need to account for a NULL
24 Jul 2014 by 1Future
Hi guys, I have got a button that is created I created using HMTL. I want when this button is clicked to call a message that i have coded using c#.My c# function generates random numbers, and I want this button in HTML when clicked to display the generated number.C# Code:public...
26 Jul 2014 by 1Future
Hello All, To begin with, I am an intermediate C# Developer (Windows Forms). I am well aware of this site and I am a regular user and when ever I ask a question I usually do show my working or code.Now, I have have just been introduced to MVC and C#.Net in which I am completely a...
26 Jul 2014 by 1Future
Hi All,I am new to MVC, But i have created a class that in the Model folder for data like so: public class Book { public int ID { get; set; } public string BookName { get; set; } public string AuthorName { get; set; } ...
26 Jul 2014 by 1Future
HI All,In my controllers folder I got an action list method that returns a book object like this: public ActionResult Test() { Book book = new Book() { ID = 1, BookName = "Abraham Life", AuthorName =...
16 Apr 2015 by 1Future
Hi All,I am having a weird error in my project which i have been trying to solve for weeks now and i wonder if you guys can help out.In my project I am references COM class (Dymo label library ) that prints labels from a label printer. Now .. Everything works well on my dev machine BUT...
5 May 2015 by 1Future
Hi All,I am just getting into the world of MVC/javascript/Ajax. I have done a lot of tutorial searches on these tools/techs.As usual , some give a good explanation and other tutorials don't .. what i am looking for is a REST application tutorial that you may have come across , an...
14 May 2015 by 1Future
Hi All,I am just getting into learning MVC .Net framework. So this might be a very basic question.In my project i am using Entity Framework and i have connect this project to a server containing the database I want to be queering from.After connecting to a database using ADO.Net, Visual...
2 Jun 2015 by 1Future
Hi All,so , I have a method in my controller like so:[HttpPost]public ActionResult Mycontroller(string RefNumber){ CustomerEntities custObj = new CustomerEntities(); var customer = from m in custObj.CustomerTbl select m; if (!string.IsNullOrEmpty(RefNumber)){ ...
10 Jun 2015 by 1Future
Hi All,somethig weird is happening to my visual studio 2013, it won't recognise standard MVC.net code i don't know why this is. for example this is what i get below: http://snag.gy/bCRdy.jpg[^]When i hover my mouse pointer on any of the red parts parts .. for example ActionResult in...
16 Jun 2015 by 1Future
Quote:using System.Web.Mvc; greyed out is greyed out therefore affecting my project. I don't know why it is greyed out because i am clearly using it my project. when i run the same project on another machine Quote:using System.Web.Mvc; greyed out is not greyed and project works fine. what...
30 Jun 2015 by 1Future
Hello All,My Project has just suddenly got this error!~:Quote:Assembly 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than...
19 Jul 2015 by 1Future
Hi All,I have a got database of vehicles. The database contains properties such as manufacturers, models, engine size and fueltype.Now in my project(View) I am displaying this data in a table and using dropdowns to filter the table. At the moment i have got a manufacturer dropdown and a...
4 Aug 2015 by 1Future
HI All,In my project...I have got an Action Result like this: public ActionResult GetPartNumber(string Id) { private readonly PartNumberEntities _Context = new PartNumberEntities(); var partnumber = _Context.Parts.SingleOrDefault(x =>...
7 Aug 2015 by 1Future
HI All,I am having an issue in my project and wonder if some can pinpoint me to where i may have gone wrong. so basically in my project i have got an ActionResult method like sopublic ActionResult PartNumberManufacturer(string id) { var partNumber =...
9 Aug 2015 by 1Future
Hi All,In my project I have got an actionResult method returning a collection of objects like this:public ActionResult PartNumberManufacturer(string id) { var partNumber = Context.PartNumberTable.Where(x => x.PartNumberId == id); return...
1 Nov 2015 by 1Future
Hi All ,In My project i have two ActionResult Methods in my Controller. The first ActionResult method is retrieving a Json from an Ajax call.ActionResult Method1 is something like this:.... public ActionResult VehicleModel(int id) { var vehicle =...
3 Nov 2015 by 1Future
Hi All,I need to get the selected value from a dropdown using jquery. Then i want to send this selected value to an Action Result Method in my controller possibly using Ajax call . As i am pretty new at this i'm not so sure on how i would achieve this.so i have got an Action Method like...
6 Nov 2015 by 1Future
Hi all,I have got method like this in my controller ...in my controller i am receiving an id and and engine values as parameters and thn i am using these to filter the data. For some reason the turbo variable is always null even tho there is data in my database. I'm not sure to why this...
10 Jan 2018 by 1Future
Hi All I'm wondering if someone can direct me to the best possible way to post data from a repeated form to a controller action. In my project i have the following: //Model Public Class TicketHoder { public string Name {get:set;} public string Mobile {get;set;} } //Action [HttpPost]...
13 Aug 2012 by 2011999
Error 1 Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
14 Aug 2012 by 2011999
Unable to find the requested .Net Framework Data Provider. It may not be installed.
2 Sep 2012 by 2011999
EMP model.FirstName) %> --%>
10 Sep 2012 by 2011999
private EmpDetailsEntities db = new EmpDetailsEntities();//// GET: /OtherSource/public ViewResult Index(){ var other_source_income = db.other_source_income.Include("login_user"); return View(other_source_income.ToList()); }in this application two...
30 Oct 2014 by 2011999
am new in mvc i have small doubt plz clarify, in my project A in this project 1 sub projectA project have 1 Properties 2 References 3 Web.configB project have 1 Properties 2 References 3 model 4 view 5 controllerhow create A project 1,2,3
30 Oct 2014 by 2011999
A project have 1 Properties2 References3 Web.configi am solving my problemadding the sub project in mvc