Click here to Skip to main content
15,886,873 members
Everything / MVC / MVC4

MVC4

MVC4

Great Reads

by Sheshnath Kumar
This article will find out a solution to serialize/deserialize object by reference at server and client, also will serialize/deserialize objects having circular references.
by SEJohnson
Linking to an existing SQLDB in ASP MVC4.0 and EF5.x.
by Arora Sumit
Routing in MVC
by Dirk_Strauss
Securing Your .NET Applications – A Summary Review Of Visual Guard

Latest Articles

by Ejrr1085
This article describes two ways of how to create a multiple HTML select control in ASP.NET MVC programmatically, using JQuery, C# and Razor.
by Mahsa Hassankashi
Best approach for having more secure channel to transfer user information throughout the web
by Khademul Basher
How to create a set of data models from a set of database tables.
by Muhammad Albedewy
Validate Anti-Forgery in 6 easy steps

All Articles

Sort by Score

MVC4 

31 Aug 2016 by Sheshnath Kumar
This article will find out a solution to serialize/deserialize object by reference at server and client, also will serialize/deserialize objects having circular references.
20 Nov 2012 by SEJohnson
Linking to an existing SQLDB in ASP MVC4.0 and EF5.x.
7 Mar 2016 by Wonde Tadesse
You will need to implement a centralized role management and use across the applications. This article will be a starting point. Introducing Single Sign-on to an existing ASP.NET MVC application[^]
21 Sep 2014 by Arora Sumit
Routing in MVC
10 Nov 2014 by Dirk_Strauss
Securing Your .NET Applications – A Summary Review Of Visual Guard
28 Dec 2015 by Dhruti90
MVC functionalities with web service with simple integration
26 Jan 2016 by yehia2amer
This method will use jQuery Ajax to POST and GET Handsontable JSON data from/to Controller in ASP.NET MVC.
15 Feb 2013 by demouser743
I would like to share the application which is done in MVC4 using Entity Framework.
14 Dec 2013 by Hammad
JavaScript $(document).ready(function () { $("#departmentList").change(function () { var dID= $(this).val(); $.getJSON("../Home/LoadPhysiansByDepartment", { deptId: dID }, function...
12 Apr 2015 by Kornfeld Eliyahu Peter
You can not use MVC to create a Windows Service[^]. Theses are two different beasts...
16 Jul 2015 by Arkadeep De
In this post, we will learn about to create a HTML jQuery CSS slider where images are binding from a specific folder.
7 Sep 2015 by Sergey Alexandrovich Kryukov
Strictly speaking, the choice of the database engine has nothing to do with MVC or any other framework on top of ASP.NET. It's enough that it worked well with ADO.NET. This choice should take into account the requirements of your application, which you did not share with us. But please don't do...
1 May 2013 by Abhishek Kumar Goswami
This helps to make a visible date field in Chrome native datepicker while it will bind from the Model in ASP.NET MVC 4.
9 May 2013 by Abhay@Accenture
15 Jul 2013 by Naz_Firdouse
Try thisDynamic Menus in ASP.NET MVC 4 using EF Code First and jQuery[^]
5 Oct 2013 by Member 10331745
Put down this 2 code above your title tag in head section.because due to compatibility issues it might not work so above code can help to solve that layer of...
5 Dec 2013 by Vi(ky
1- Create a model CurrentReport.cs public class CurrentReport { //both property contain data from a two different table public IEnumerable OTablesFields { get; set; } //for webgrid header public List dataField { get; set; } //for...
24 Dec 2013 by Sergey Alexandrovich Kryukov
In addition to Solution 1:Please see the explanation of push technology: http://en.wikipedia.org/wiki/Server_push[^].Isn't that obvious why traditional client-server model and pull technology predominantly used on the Web is bad for such a basic application as a chat? The client side...
6 Mar 2014 by OriginalGriff
Look at your namespaces:namespace TCSCloud.Domain.RepairOrder.Model{ public class UpdateRepairOrder : Base.BaseAndusing TCSCloud.Domain.RepairOrder;using Oracle.DataAccess.Client;namespace TcsCloud.Repository.RepairOrderManagement{ class...
12 Mar 2014 by Philippe Mori
You don't want to display all record at once. It would take forever and the browser might run out of memory... You'll have to use paging and display say 2000 pages of 500 records.It does not make much sense to display more than a few thousand records at once in client/server architecture as...
11 Mar 2014 by Maciej Los
Read this post to the end: Detecting Session Timeout in ASP.NET MVC 4[^]
30 Mar 2014 by Sergey Alexandrovich Kryukov
Not only you did not show where the exception with the message "Object reference not set to an instance of an object" is thrown, you did not even show any code. How do you think anyone could help you to fix the problem? You cannot ask such questions every time you face with such situations; you...
8 Apr 2014 by Guruprasad.K.Basavaraju
Here is an example that you should be able to use.http://jquery-datatables-column-filter.googlecode.com/svn/trunk/dateRange.html[^]
13 Apr 2014 by Edson_Ferreira
This tip will demonstrate how to create a SPA using an MVC Application, AJAX and History.js
18 Apr 2014 by Guruprasad.K.Basavaraju
I am not sure of Bootstrap but you can simply apply the same class to second TD using the Javascripts after the table is created.$(function() { $(".table-class tr").each(function() { $(this).find('td:eq(2)').addClass("hidden-xs"); });});
7 May 2014 by Kornfeld Eliyahu Peter
There is no way to get name for sure - it depends on the ability of the various DNS servers between your server and the client.HttpRequest.UserHostName[^] should give you that name, but in most cases it gives IP address...
8 May 2014 by sankarsan parida
Add a line after in Index view of Product controller @Html.RenderPartial("myview",Model)
5 Sep 2014 by OriginalGriff
You can't use ":" in the Url - it won't work.Instead, why not your the value that DateTime is based around: the Ticks property? It's an Int64 value so there is no problem in transferring it around, and DateTime has a constructor which works from it directly.
8 Sep 2014 by Raul Iloc
1.For session expiration, you could do this by managing Session_End event in MvcApplication class from your Global.asax.cs, like in the next example:protected void Session_End(object sender, EventArgs e) { SiteSession siteSession = (Session["SiteSession"] == null ? null :...
3 Oct 2014 by Snesh Prajapati
Here are the solutions for similar issue:http://stackoverflow.com/questions/22555533/form-submit-not-working-in-firefox[^]http://stackoverflow.com/questions/17968565/mozilla-form-submit-not-working[^]Please try and let us know the result.
9 Nov 2014 by Mehdi Gholam
Try a double == :objstudentdetail = (from data in objentity.studentdetailswhere data.studentid == StudentIdselect data).FirstOrDefault();
24 Jan 2016 by raddevus
This article extends the 2-part article I wrote showing you how to write your own blog engine in ASP.NET MVC.
16 Feb 2016 by Dave Kreskowiak
There is no limit to the size of the field. Well, technically, it can hold 2.147 billion characters but that's not what you're talking about.If you're referring to a field that is submitted back to the server, then the limit is the maximum request size. For a HTTP GET that's usually about...
29 Feb 2016 by debashishPaul
Probably you haven't searched enough... In my first search with "hash salt C#" I got these two:Salted Password Hashing - Doing it Right[^]How to Validate Passwords[^]
21 Apr 2016 by Dave Kreskowiak
You cannot communicate with the client devices from the server.Also, code running in a clients browser cannot talk to hardware connected to them without installing software on them outside of the browser.
21 Jun 2016 by Sergey Alexandrovich Kryukov
The method CreatePassword has two return statements. If ModelState.IsValid evaluates to false, nothing is returned. In case of true, if uname == null still nothing is returned.return JsonConvert.DeserializeObject… — please provide error information. Something can be missing,...
29 Jun 2016 by Dave Kreskowiak
First, remove your email address from the code snippets. Spammers have bots that comb through sites, including this one, looking for email addresses. If you love getting spam, fine, leave it in there. If not, remove it.Next, MVC doesn't have any concept of a Page_Load event. I think you...
11 Aug 2016 by Richard Deeming
Use the HTML5 and elements:Using HTML5 audio and video - Web developer guides | MDN[^]You'll need to make sure you have the relevant formats required to support different browsers:Media formats supported by the HTML audio and video elements - HTML | MDN[^]To load the...
31 Aug 2016 by OriginalGriff
We do not assist with this: downloading and storage of YouTube content in any form is against their Terms & Conditions, so such code is technically malicious.We do not condone, support, or assist in the production of malicious code in any way, form, or manner. This is a professional site for...
14 Sep 2016 by StM0n
3-tier is a subste of n-tier architecture... it's mostly about the layering of your software system, eg 3-tier consists the layer of* front-end or presentation* application- or business-logic* back-end or storageso n-tier is an architecture, which is build upon more layer, which...
4 Sep 2019 by CHill60
So it worked for 4 to 5 videos then stopped? Try this Google[^] search - then you will discover that you are limited Quote: To prevent spam, all Dailymotion users are limited to: 10 uploads per day. 2 hours of video per day. 60 minutes per video. You have exceeded your quota.
11 Jan 2015 by Abhinaw Kumar
In MVC, there is no helpers for generating links based on absolute URLS (i.e., to external resources). But you can write your own helper for that if you want the view to look nice with the consistent Helper...
9 Jul 2012 by OriginalGriff
An empty Guid is always the same value: 00000000-0000-0000-0000-000000000000So the Regex would be trivial:00000000-0000-0000-0000-000000000000Why do I get the feeling this is not the question you meant to ask?
9 Jul 2012 by Manas Bhardwaj
try this:public static bool IsGUID(string expression){ if (expression != null) { Regex guidRegEx = new Regex(@"^(\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\}{0,1})$"); return guidRegEx.IsMatch(expression); ...
7 Nov 2012 by Aydin Khatamneajd
Using ModelMetadataProvider to Set Display Name Metadata for the Model Fields at Runtime
27 Dec 2012 by Karl Stoney
This .NET Tutorial will tell you how to Install and Configure MiniProfiler for .NET 4.5 MVC 4 Web Application including Entity Framework logging.
30 Dec 2012 by Karl Stoney
In this programming article, I will show how to generate an approved sitemap automatically for use with search engines.
13 Mar 2013 by Keifiechief
Quick descriptionI have a simple ASP.NET MVC application with two views. One of those views has a button which uses an Ajax form submit to call a method on the controller.That method on the controller first makes an asynchronous method call on the model instance which executes a long running...
6 Jun 2013 by freedeveloper
A tutorial to catch the Model in your client side and use client events to show filtered information without returning to server
11 Jul 2013 by Priyanka7777
Try: Session["UserID"] = UserID;
11 Jul 2013 by vinayakJJ
// storing value in sessionstring firstName = "Jeff";Session["FirstName"] = firstName;//reading value from sessionstring firstName = (string)(Session["FirstName"]);
3 Mar 2017 by ravijmca
I;m trying to use Jquery Model Dialog in MVC4 using Razor dialog box showing fine but AjaxOptions.OnSuccess javascript function is not calling after i click the update button but it's redirected to http://:3738/Cars/Edit/1?Length=4 i don;t know why it was happened.Here is my...
29 Oct 2013 by Gopal Rakhal
hello all,I want to insert multiple records in database as we do using Gridview(with checkbox checked) in aspx, am not able to understand that how to do so as am beginner to MVC. Plz suggest methanking all...
6 Nov 2013 by ♥…ЯҠ…♥
Hi Murugappan,In razor, everything is easy just add @readonly attribute to the code will do the needful.Like this@Html.TextBox("PatientID",new { @readonly="readonly" })Hope this helps you a bit.Regards,RK
6 Dec 2013 by Wombaticus
reslts in milesSELECT id, ( 3959 * acos( cos( radians(YOUR_LATITUDE) ) * cos( radians( YOUR_DB_LAT_FIELD ) ) * cos( radians( YOUR_DB_LNG_FIELD )- radians(YOUR_LONGITUDE) ) + sin( radians(YOUR_LATITUDE) ) * sin( radians( YOUR_DB_LAT_FIELD ) ) ) ) AS distanceFROM YOUR_DB_TABLE HAVING...
30 Jan 2018 by Mohsin Mustufa
hii have two dropdownlist on a page i want that when i select some value from first dropdown list then in second dropdownlist all the values load according to the value selected both dropdown lists are binded dynamicallyViewFirst...
23 Dec 2013 by JoCodes
Using Signal R is a good option . Refer...
6 Feb 2014 by Rockstar_
Hi,Using Jquery....Try this, var len = $('.text-box').length;
13 Feb 2014 by Sampath Lokuge
For that you have to create ViewModel.Then fill that ViewModel from your domain models data and bind that into your view (i.e. ViewModel to View).What is a ViewModel ?# Allow you to shape multiple entities from one or more data models or sources into a single object# Optimized for...
25 Feb 2014 by Nimit Joshi
You can refer the following link to broadcast the message to clients using the MVC 5:SignalR Use in MVC 5
23 Mar 2014 by Raul Iloc
1.If you are trying to allow access only to authorized users, the management of unauthorized access to site functionalities should be done by using the [Authorize] attribute. So in all controllers' public actions that require authentication we must use this attribute, and in the controller...
3 Apr 2014 by Guruprasad.K.Basavaraju
You may want to use something like thismodel.txtFrmDate=System.DateTime.Today.ToShortDateString()
8 Apr 2014 by Guruprasad.K.Basavaraju
You will need to refer to a model in the view as Model and not @Model.Example:Model.EmployeeId.The @model is just a key to assign the incoming model to the model property of the page.Model is a property of the associated System.Web.Mvc.View DataDictionary object (which is your page/view)
15 Apr 2014 by Guruprasad.K.Basavaraju
Remember, your On Blur is ocnfigured to call submit which will post back the edited data to server.Below is the snippet in Jquery.jeditable.js file which does this./* add edited content and id of edited element to POST */ var submitdata = {}; ...
15 Apr 2014 by Guruprasad.K.Basavaraju
Change the below line in public ActionResult AjaxDataProvider(JQueryDataTableParamModel param)var result = from c in displayedCompanies select new[] { Convert.ToString(c.ID), c.Name, c.Address, c.Town };TOvar result = from c in displayedCompanies select new[] {...
14 Jun 2014 by Raul Iloc
1.You forgot to give details about the error;2.If you want to search by name as you said, you should change your code like this:public ActionResult Search(Player player){string playerName = palyer.PlayerName; //Should be the player name that come from UI!Player player=...
29 Jun 2014 by Cesar Bretana Gonzalez
ok, Razor is just another Server Side Language, you can use it opening an ¨at¨(@), and use the same C# code you normally use, is just that, MVC is Model View Controller, the Model is just all the classes on your system, the Controller is the interaction between the Model and the View, and the...
26 Aug 2014 by Gihan Liyanage
ExecuteScalar() only returns the value from the first column of the first row of your query.ExecuteReader() returns an object that can iterate over the entire result set.ExecuteNonQuery() does not return data at all: only the number of rows affected by an insert, update, or...
27 Aug 2014 by uspatel
suppose you have two buttons on your UI ...
8 Sep 2014 by Sergey Alexandrovich Kryukov
In what you have observed, there was no such thing as "metadata classes". (Such concept does exist, but this is not what you have been looking at.) You faced completely different thing: you tried to see the declaration of .NET types without having the source code. The source code is simply not...
17 Sep 2014 by Shemeemsha (ഷെമീംഷ)
These links may helpful http://stackoverflow.com/questions/16255882/how-to-upload-image-display-image-in-asp-net-mvc-4[^]http://stackoverflow.com/questions/20446580/upload-image-included-in-mvc-model[^]@using (Html.BeginForm("Index", "FileUploader", FormMethod.Post, new { enctype =...
21 Oct 2014 by vaibhavnigam383
Greetings to allI am using unit of work, repository pattern with entity framework 6 (code first approach) along with dependency injection,I have extended my repository to execute stored procedures as belowpublic List ExecuteStoreProcedure(IUnitOfWork unitofWork, string spName, params...
7 Nov 2014 by Suraj Sahoo | Coding Passion
CRUD OPERATIONS[^]CRUD OPERATION[^]C# [^]Go through these linksHope this helpsThanks
8 Nov 2014 by Manas Bhardwaj
Any effort? If you search internet, this topic has been explored numerous times. Look at this article on ASP.Net...
24 Nov 2014 by Suraj Sahoo | Coding Passion
Hello Sir,Step1- You need to build the solution once after Updating and Validating the .edmx file.Step2- Then you need to expand the .edmx file and look for the T4 template file, i.e. .tt extension file. Step3- Right click on that and Run Custom Tool. This would update the .tt file with...
24 Nov 2014 by Suraj Sahoo | Coding Passion
Quote:I don't have fixed Database Design ,i may modify existing table may add new table .As you say here, I anticipate you already have a database and may be you need modification in there in future. So I would suggest to opt for Database first approach. As you just need to add your database...
24 Nov 2014 by Sandeep Singh Shekhawat
Hi,The ADO.NET Entity Framework allows developers to choose any one approach among three possible approaches: Database First, Model First and Code First.Database First: It is a more data-centric design that is based on an existing database. The Entity Framework is able to generate a...
18 Dec 2014 by Member 2374010
I came across this little hack, which resolves the problem of no files for Ajax.BeginForm submissions:window.addEventListener("submit", function (e) { var form = e.target; if (form.getAttribute("enctype") === "multipart/form-data") { if (form.dataset.ajax) { ...
21 Jan 2015 by Manoj Kumar Choubey
1. Code firstIn the Code First approach, we focus on the domain design or entities/POCO classes first and create classes as per our model requirement. We do not have the database of the application, rather we create database automatically from code after defining our domain. No matter, you...
13 Feb 2015 by Wendelius
This problem has been answered quite thoroughly over here[^]also I think you should go through Don’t use Code First by mistake[^]
14 Feb 2015 by Abhinav S
You can do this by using JavaScript -http://www.aspsnippets.com/Articles/Create-dynamic-textbox-using-JavaScript-in-ASP.Net.aspx[^]This can also be done via code behind -Adding Controls to an ASP.NET form Dynamically[^]C#.Net - Dynamically create textbox in asp.net [^]
20 May 2015 by Manoj Sawant
In MVC you can not use a Report Viewer in View. You can add a .aspx page in MVC project and can use the Report Viewer.
4 Aug 2015 by F-ES Sitecore
Without using EF and also without ado.net? You could use ODBC libraries but you're seriously better sticking to ado.net. ado.net is the most basic .net framework for connecting to databases so you should use it, there is nothing wrong with it.If you mean without EF and just ado.net, then...
17 Aug 2015 by OriginalGriff
Try:CREATE PROCEDURE DoMySelect @SEARCH NVARCHAR(100)ASBEGIN SET NOCOUNT ON; SELECT * FROM tblBusinessCategory AS b INNER JOIN tblUser AS u ON b.BusinessID=u.BusinessCategoryId INNER JOIN tblAddress AS a ON u.AddressId=a.AddressID WHERE...
19 Aug 2015 by OriginalGriff
We can't tell you why - because we don't have access to your data, and can't run your program under the same conditions you do as a result.But you can look at it yourself, and find out.Use the debugger.First, to make it easier for you, break out that line:var tdsA =...
21 Oct 2015 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Nothing is urgent here. We help each other according to our availability. Next time please don't say that something is urgent.Also before asking a question do proper search in google or Bing. You might find the answer as I did. I found the first link in google regarding your question.MVC...
28 Oct 2015 by F-ES Sitecore
If you don't want to use any third-party tools then you'll need to learn the PDF format and how to create PDF documents yourself. .net has no in-built for PDF as it is a proprietary format so you're going to have to use some form of third party tool or do it yourself.
28 Oct 2015 by Zoltán Zörgő
HTML5 and PDF have two different view on the concept of "document". Please note, that PDF is based on PostScript, which is a complex programmable descriptive language for printers. The web for which html5, css3 and other things bootstrap relies on are living in a totally different world.So...
29 Nov 2015 by jagan12013
[HttpPost]public ActionResult Solution(List model){ if (ModelState.IsValid) { ALBulkTestResult obj = new ALBulkTestResult(); var now = DateTime.Now; var date = new DateTime(now.Year, now.Month, now.Day, ...
21 Dec 2015 by CHill60
Add a reference to System.Data.Entity.dll in the Framework references
6 Jan 2016 by Maciej Los
Start here: Google[^]. Over 134K results in 0.34 s!Here is one of them: Code Sample: ASP.NET MVC 3 Custom Login Page[^]
8 Jan 2016 by Richard MacCutchan
See OpenTok Developer Center - Everything you need to build WebRTC apps with OpenTok[^].
24 Feb 2016 by Pavel Rytikov
Simple pattern which I use to solve view model filling problem
25 Feb 2016 by Dave Kreskowiak
The class you're trying to use, CsvReader, is not part of the .NET Framework. It has to be in an external .DLL somewhere. You can probably get that from wherever you got the code you copied.You then have to add a Reference to that .DLL and then import the namespace exposed by that .DLL that...
4 Apr 2016 by Karthik_Mahalingam
Either you need to make the param1 data type as Nullable DataTime DateTime? (or) Nullable while passing the date value from the javascript, cast it to a proper date time.usingjavascriptDateObject.toUTCString()or using Stringify, check the below urljquery - Pass a datetime from...
19 Apr 2016 by Karthik_Mahalingam
Check for Null value in the collection if(result !=null)foreach(var item in result) if(mobile!=null) foreach(var item1 in mobile)
8 May 2016 by Kornfeld Eliyahu Peter
You have to understand, that the very moment you display something on a web page that content is on the end user's machine...So even you prevent from downloading the pdf file behind the report, the end user can save it page-by-page (like paging and hitting 'Print Screen'), so the report is...
9 May 2016 by Karthik_Mahalingam
customize it based on your need using css[^] function showbaloon(elem) { elem.style.display = "block"; } function hidebaloon(elem) { ...
21 Jun 2016 by Karthik_Mahalingam
try like this string currentDate = DateTime.Now.ToString("dd/MM/yyyy"); var data = db.expense.Join(db.Itemmodels, exp => exp.ITEMID, im => im.id, (exp, im) => new { exp = exp, im = im }) .Where(o => o.exp.EntryDate == currentDate && o.exp.Manager ==...
22 Jun 2016 by Karthik_Mahalingam
try this var d =new Date(employee.DOB); var datestring =("0"+(d.getMonth()+1)).slice(-2) +"/" + ("0" + d.getDate()).slice(-2) + "/" + + d.getFullYear(); $scope.employeeDOB = datestring;