Click here to Skip to main content
15,893,622 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 Updated

MVC4 

15 Dec 2013 by #realJSOP
Using VS2012/MVC4:I have an existing small asp.net web site (not a web app). The owner wants an estore, so I'm checking out nopcommerce. I have *very limited* experience with mvc.I downloaded and installed nopcommerce 3.20 and looked around in the file structure. It contains two mvc...
17 Oct 2016 by #realJSOP
The only real way to add XML comments to your code is to do it manually. There is a helper extension available for Visual Studio, called GhostDoc. It helps ease the pain a little.Of course, you could write an application to do it for you, but it would take a lot less time manually commenting...
15 Dec 2016 by #realJSOP
Do this:if (cities.Count(x => x.IsSelected == true) == 0)
15 Dec 2016 by #realJSOP
Casting is expensive. Do it this way.Selected = (city.IsSelected == true)
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,...
22 Sep 2019 by #realJSOP
The app isn't necessarily running slow, but the queries might be. Honestly, there's nothing we can do for you without seeing the schema, and all the code. Some advice I can give is (in no particular order): 0) Avoid calling user-defined functions from a query. That is a TRUE performance...
7 Oct 2021 by .NET- India
I have "Datatbase1.tt" file as i press "ctrl+s"(save) then i get this error "Could not find an implementation of the query pattern for source type 'int'. 'Select' not found " on "bold font text" below using (var context = new...
7 Dec 2014 by /\jmot
See..http://sudarsandash.blo...
4 Feb 2015 by /\jmot
Ref,http://www.codeproject.com/search.aspx?q=asp.net+mvc+sample+project[^]http://www.asp.net/aspnet/samples/aspnet-mvc[^]http://mvccontrib.codeplex.com/releases[^]
11 Oct 2017 by 1Future
Hi, I have a partial view with another partial view. When i try to post the data from the partial view to Action method nothing happens.Even when i put a break point in the action method nothing happens .. it doesn't hit the break point. is there anything i'm doing wrong below? or could someone...
10 Nov 2014 by 2011999
[HttpPost] public ActionResult Save(tblUserInfo userinfo) { string message = ""; if(ModelState.IsValid) { try { using(AjaxInsertDBEntities aid=new AjaxInsertDBEntities()) { ...
19 Dec 2013 by 24983
Hi, I have created Empty Application in mvc4 using Razor.Then i got error "Resourse cannot be found". I tried lot of ways but still got error. If any one knows Please let me know.
24 Jul 2016 by 4L4K1
hiwhy jquery does not work in kendo grid popup windows?I have a dropdownlist and a textbox in popup.i want to fill textbox according to selected value of dropdownlist.but jquery does not work.thank you in advanceWhat I have tried:i add a kendo grid and set popup windows for...
14 Nov 2014 by @Kathukkutti
Hi, I'm trying to add my routing pattern along with the defult routing rules. routes.MapRoute( name: "myRouting", url: "{action}/{controller}/{id}", defaults: new {action = "Index", controller = "Home", id = UrlParameter.Optional } ...
25 Nov 2014 by @Kathukkutti
Hi,I've _ViewStart.cshtml in root level with the following code@{ Layout = "~/Views/Shared/_Layout.cshtml";}But it is not applying in my Views inside my Area (Area/MyArea/Views/Index.cshtml).To make it done, i dont want to create an another (new) _ViewStart.cshtml in the views...
30 Nov 2015 by @shok kumar mishra
I have created a Shopping Cart.In Which I have to store a multiple images for a single product.I have sucessfully done multiple images for the single Product. Now i want to display a single images among the uploaded images in the product listing pages. Like any shopping site when u choose any...
23 Dec 2015 by @shok kumar mishra
When I want to insert the date into sql database it shows error String was not recognized as a valid DateTime.Please help me out how to insert date into sql server by using mvc franework. This is the sql tableSELECT TOP 1000 [Id] ,[FirstName] ,[LastName] ,[Email] ...
11 Dec 2017 by ________________
Comma separated file: using (SqlConnection con = new SqlConnection(sqlConnectionString)) { con.Open(); SqlCommand cmd = new SqlCommand("select query from report_query where query_id=@id", con); cmd.Parameters.AddWithValue("@id", id); string query =...
9 Feb 2014 by __Veereshkumar
HiI was breaking my head over it for the past hour and finally found it. :)U just have to create a default.aspx page in your web service project..!following is the link that should solve your doubt...http://msdn.microsoft.com/en-us/library/ms243399(v=vs.90).aspx
15 May 2013 by _Amy
You need to use javascript ConfirmBox[^] for confirmation before saving and AlertBox[^] to show the notification after saving.---Amit
8 Apr 2014 by _Asif_
Dear All,My problem lies in the application design. We have used Areas to modularize our medium scale application. The problem comes when we get a usecase which requires an action or view to get executed but residing in a different areas. For example we are in Contract area -> Search...
10 Apr 2014 by _Asif_
I have resolved it by adding Area = "Contract", in Callbackroute as shown below. This is just for the referencesettings.CallbackRouteValues = new { Area = "Contract", Controller = "Variation", Action = "GetAddEditVariationForm" };
22 Apr 2014 by _Asif_
Check below URL.How to Load a dropdownlist from database data[^]
26 May 2014 by _Asif_
Check this link, might help you in number of ways.Another set of ASP.NET MVC (4) tips[^]
18 Dec 2015 by _Asif_
Automatically deleted in SQL Server? Not Possible! PeriodThe problem is in your code (code, triggers, Job, transaction, etc) not in the sql server for this kind of issue
8 Nov 2014 by _Cantus
Code first,and create strong model,it will Automatically generate create,delete,update.also you can use repository model or something you define.one word,it is like linq.
1 Jun 2015 by _Dhull
EASY SOLUTION:-function SHowDiv(){ $('#Div1').html('A');}
12 Dec 2015 by _ProgProg_
Dear All,I am trying to implement localization to stringlength attribute for all models with the same way i have localized the DisplayName attribute.The only change is that i will take the new value from the core class mapped attribute not from a resource file.I am using...
14 Apr 2016 by _ProgProg_
Dears,I want to do some weird job which is: adding attributes dynamically to my model class without adding these attributes directly on each property in the model class.the whole story is:I have an MVC project using Code first with domain driven design so i have the following:Core...
8 May 2016 by _ProgProg_
Dear,I have a request from my Business owner to prevent user from downloading report.Now i am displaying my report in browser using the following code:private void DisplayReportInBrowser() { // Variables Warning[] warnings; string[]...
14 Nov 2019 by _ProgProg_
Dears,I want to directly send array of bytes to printer once the user clicks print buttonthe user shouldn't keep the pdf file with him. That's the problem.i have a byte array contains my pdf file (images and text) that needs to be printed.Any ideas?What I have tried:i am...
27 Jun 2016 by _ProgProg_
Dears,I have two array of bytes each one of them represents a report of one page.i want to to merge them and generates a pdf report of two pages.how can i do that?What I have tried:byte[] bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out...
2 Nov 2018 by _ProgProg_
Dears, I 've a situation here in uploading multiple files from multiple controls in asp.net mvc. How can i differentiate (grouping) between files of each file upload controls? In HTML: Here is the uploaders:
8 Jul 2014 by _Zorro_
Why can't you just google for that information...?Gmail API[^]Quickstart[^]
20 Aug 2012 by A M SOMAN
Can anybody please share a good example of how to save html content as Word or Pdf file using ASP.NET MVC? I am showing a result summary to user on my View page. I want to give a feature to save this summary in Word / Pdf format on click of "save" button.I read about setting the...
15 Sep 2014 by a.anvesh
I have dropdown with values, whenever user selects a value from dropdown on change event it fetch data from table through EF and display in the page i.e. has input textboxes.Thanks in advance
15 Jul 2013 by a.pkumar
Hi to all,i am practing mvc. started with sample application. the code is as followsDesign page @Html.ActionLink("Home", "Index", "Home") @Html.Label("Cluster Id") @Html.TextBox("txtid") ...
2 Jul 2013 by a_sof2008@yahoo.com
learn full mvc4 C# by json.......
18 Sep 2015 by Aakash Bashyal
i have a request in xml or json. How can i check whether the request contain a missing body or invalid body item. content-type:application/json;Method:Post;{"UserName":"tom12","Password":"XXXXXXXXX","FirstName":"tom","LastName":"jack", "MiddleName":"dick"}their may be MiddleName...
28 Aug 2015 by Aalaa Abo Omar
Hello,I'm beginner in ASP.net MVC4. And I'm trying to display the content of the word and excel file in my web page. I wrote this function in the HomeController , but it didn't display the content. it only downloaded the file. how can I preview the file in my webpage? Thanks [HttpGet]...
26 Aug 2014 by Aashish vermaa
Hi,I have some queries regarding session and view state in MVC 4.0: 1. Can we use session and view state in MVC 4.0. 2. Is there any better alternative of session and view state.Thanks & regards,Ashish
27 Aug 2014 by Aashish vermaa
Hi,Can we add and edit record in MVC 4.0 using Entity Framework in a single Action and View?Please suggests me.Thank you,Regards,Ashish
29 Aug 2014 by Aashish vermaa
Hi,I need some help in the following seniors:1. I have a view page where I display around 10 records without using any filter condition. But after all the data bind on the page, user could search a particular record or filter record. How can I achieve this functionality using...
1 Sep 2014 by Aashish vermaa
Hi,Can we change date formate in cshtml file in MVC 4.0?If yes then how can we change the date formate to dd MMMM yyyy(01 Aug 2014).Please suggest.Thank you,Regards,Ashish
3 Sep 2014 by Aashish vermaa
Hi,I need to add following validations on upload image control(@Html.TextBoxFor(model => model.image, new { type = "file", accept = "image/*" })): *image type, *image sizeBut I do not want to add require field validator on this control.I want that when a user upload a image...
3 Sep 2014 by Aashish vermaa
Hi,I have two radio buttons(True and False) on a page.I could get the value Zero or 1 from the database.When I get the value 1 then "True" radio button should be checked otherwise "False" should be checked.How could I achieve this functionality in MVC 4.0?Please give your...
5 Sep 2014 by Aashish vermaa
CSHTML Code:------------ @Html.RadioButtonFor(model => model.trueFalseAnswer, true, new { id = "TrueFalseAnswer_true" }) True @Html.RadioButtonFor(model => model.trueFalseAnswer, false, new { id = "TrueFalseAnswer_false" }) False
5 Sep 2014 by Aashish vermaa
Hi,Please suggest me any third party tool or theme template which is user friendly from the perspective of user as well as developer.Thank you,Regards,Ashish
10 Sep 2014 by Aashish vermaa
Hi,I want a replacement of nested repeater in MVC 4.0.Actually, My scenario is something like:* I have a table "tbl_class" which contains contains records of all the classes(id, class, floor)* I have another table "tbl_students" which contains records of all the student(id, ...
14 Sep 2014 by Aashish vermaa
Hi,How could I dynamically change the css of a actionLink control on CSHTML page.Suppose, I am getting a "type" parameter on the CSHTML page and on this "type" parameter basis I want to change the css of "ActionLink" on a CSHTML page.Please suggest.Thank you,Regards,Ashish
15 Sep 2014 by Aashish vermaa
@Html.ActionLink("Home", "", "", null, (ViewBag.type == "your type") ? new { @class = "typeclass" } : new { @class = "otherclass" })
15 Sep 2014 by Aashish vermaa
Hi,How can we set the url(Action, controller and query string) using javascript in mvc.Please suggest.Thank you,Regards,Ashish
17 Sep 2014 by Aashish vermaa
javascript:function OnEdit(link) {debugger;if (sectionId != 0 && sectionId != "a") {link.originalHref = link.originalHref || link.href;link.href = link.originalHref.replace("-1", sectionId);}else if (sectionId == "a") {alert('Please add section first');return...
22 Sep 2014 by Aashish vermaa
Hi,I want to use control like Stepper but not for numeric value:http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_type_numberI want to bind User names in this control.How can I achieve this?Please suggest.Regards,Ashish
28 Sep 2014 by Aashish vermaa
Hi,I have a table which contains some data.This table has a column which contains data with HTML tags.But the scenario is this:1. This column can not have same values.2. When a user comes second time to insert new record then it first check the new value with existing value to...
18 Nov 2014 by Aashish vermaa
Hi,I am using entity framework for getting the result from database with the help of the following query:var resManagerGroup = (from objManagerGroup in objEntities.LK_MANAGER_GROUP where objManagerGroup.user_id == iManagerId && objManagerGroup.group_id...
20 Nov 2013 by aatish442000
I have a requirement in MVC4 with razor to send mail to a person.I have added view with tosend,mesage,subject and file with two button add file and send.as;@html.Textboxfor(m=m.Files)
17 Aug 2013 by abbaspirmoradi
If you googling you can see many examples.try with this examples...
3 Dec 2013 by abbaspirmoradi
Hi, look at this example.You can use a string for create your model.it string can have your table fields that you create into database.I hope it can help you: string modelDefinition = @"using System; using System.CodeDom.Compiler; using System.Collections.Generic; ...
30 Aug 2016 by Abdallah yahya
Drag and Drop Rows between Grids | Kendo UI Grid[^]
29 Nov 2018 by Abdelrahman Ismaeel Hegazy
try anther internet connection without any domain Administration
6 May 2017 by Abdul Hannan
Hi Friends Since i am new to asp.net mvc Getting this error I want to show Profile to user in View It shows this error "The name 'o' does not exist in the current context" What I have tried: View @model Test.Models.Customer @o.CST_Name @o.CST_Email ...
31 Jul 2013 by Abdul Q
Hi,I am new to ASP.NET Single Page Application (SPA) using Backbone.js and Marionette.jsCan anybody provide a solid code example with explanation to get started with Visual Studio 2012Actually, I need a working example in VS2012 using ASP.NET SPA(MVC4) + Backbone.js and Marionette.js...
22 May 2016 by abdul subhan mohammed
Hi guys,i'm new to MVC.I have creating one application in mvc.Where i have create view, in which i have bind department dropdownlistfor and successfully i had bind.But, after inserting all the values in the create form, when i clicked submit button.i got this error:There is...
21 May 2013 by Abhai Oza
Hi...Show this Example.[^]I read this example and create this type application but pageing not developing i have create Controllers and but not @model PagedList.IPagedList type of view create so please help me.How to change or anthoer way pageing in MVC4.
17 Jan 2015 by Abhai Oza
Hello....How to save image in binary format in sql database and get image using jsone in MVC4.
19 Jan 2015 by Abhai Oza
Hello,I have store image byte format in database and get image in MVC4. I have write this code but call only one time but i am call every time how to call control method using JQueryI have Use MVC 4 this code.Jquery Load...
23 Feb 2015 by Abhai Oza
Dear ...I have don't call particular validation in my web Page.My class file.public partial class AssessmentReporttext { public int ID { get; set; } [Required(ErrorMessage = "Assessment is required")] public string Assessment { get; set; } ...
24 Jan 2017 by Abhai Oza
Hello...How to integrated ccavenue payment getway in MVC4.give me perfect example or step by step process or other example to use paymentgetway.. ??
29 Apr 2015 by Abhai Oza
Hello...I have host web site "http://movecdev.azurewebsites.net" and Use WCF services and hose wcf services "http://111.93.83.62:1009/Service1.svc" When i run particular page then i got this type of error.System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL...
9 May 2013 by Abhay@Accenture
21 Dec 2017 by abhi Chary
where do i store this heavy data(almost 500gb per user all over the world), what is the best way to upload heavy data(only videos,images) and how to stream it shall i store in database? What I have tried: i tried chunking concept to upload,but where to store this heavy videos/images Upload...
15 Mar 2015 by Abhi KA
Hi,i am saving image in SQL Server bytes format through input type control While in editing i am getting bytes, how to bind that image to input control?is it possible to get image bytes from control ?
28 Aug 2015 by abhijeetgupta1988
Follow these links :http://www.wikihow.com/Geocode-an-Address-in-Google-Maps-Javascript[^]http://www.chautauquahomes.us/wikihow/geocode/default.aspx[^] Implementation :http://www.ceat.com/locator.aspx[^]Click on "Detect Location" button.You need to pass the address...
20 Jan 2016 by Abhijit Parab
Hi, I am trying Jqgrid using web api in mvc4. i have proper libraries for jquery and jqgrid. but still on loading of view page it raise error as "Object doesn't support property or method 'jqGrid'" Following is the code for that. It will be help if i get solution for this.@{ ...
11 Jul 2016 by Abhilash.J.A
Sir, I am trying to create a pie chart, then export to word using OpenXml in c#.net. But the problem is, 1) It is exporting but nothing shows ms word 2010 only. 2) I am using ASP.NET MVC4 project, there is a google pie chart which has around 1000 data by representing with multiple...
12 Jan 2016 by Abhilask kumar
I want to add a partialview(With some databse's datas) for common view to all page.I did that, when partialview render from other view then not invoke controller PartialViewResult but invoke if direct render from url(localhost/Home/partialviewName).code is bellowThis is controller...
21 Jun 2016 by Abhilask kumar
I have two model first is expense and second is Itemmodels. Store all Product in Itemmodels with id,Name and in expense store only itemId. so i need get record from both table through join code is below. But this is fetch error:LINQ to Entities does not recognize the method 'System.String...
16 Nov 2018 by Abhilask kumar
Hi, Actually i have mvc project and make js bundle dynamically. But after 1-2 day js file has been corrupt and then js action has stopped working then i'm copy all js to live server then application has worked fine. Please tell my why js file has corrupt? What I have tried: still i don't...
9 Dec 2012 by Abhinav S
Why dont you start with some basic examples - http://www.asp.net/mvc/mvc4[^]http://net.tutsplus.com/tutorials/building-an-asp-net-mvc4-application-with-ef-and-webapi/[^]http://www.hanselman.com/blog/MakingASwitchableDesktopAndMobileSiteWithASPNETMVC4AndJQueryMobile.aspx[^]
26 Jun 2013 by Abhinav S
You might want to visit http://mvccontrolstoolkit.codeplex.com/[^].
5 Oct 2013 by Abhinav S
There seems to be a problem with the column name in the query - Department_Id. The a is missing.
6 Nov 2013 by Abhinav S
@readonly = true; should also work - http://slodge.blogspot.in/2010/11/razor-mvc3-readonly-textbox.html[^].
8 Jan 2014 by Abhinav S
Metatags can be used for this task.In your aspx, point to the appropriate page.
21 Jan 2014 by Abhinav S
Tryhttp://codereferences.blogspot.in/2013/06/using-oracle-database-with-visual.html[^]http://www.devart.com/dotconnect/oracle/articles/extendedmembership-tutorial.html[^]https://docs.google.com/document/d/13b1Fy9k4jb5-B28Am379s7HRhS4g80ooLvZB4RWzHYI/edit?pli=1[^]
5 Feb 2014 by Abhinav S
Use Convert.ToBoolean to convert the values to boolean.Then do the comparison.
14 Feb 2014 by Abhinav S
TryUploading a File (Or Files) With ASP.NET MVC[^]Implementing HTTP File Upload with ASP.NET MVC[^]Uploading and returning files in ASP.NET MVC[^]
23 Feb 2014 by Abhinav S
Razor is closer to C#. Thus if you are comfortable with C#, think about Razor.Razor offers more compact syntax.
24 Feb 2014 by Abhinav S
Try the solution on this thread - http://blogs.msdn.com/b/vstsqualitytools/archive/2009/12/09/logging-a-message-in-test-result-as-part-of-an-automated-test.aspx[^].To save test case results, try http://msdn.microsoft.com/en-us/library/ms404662.aspx[^].
7 Mar 2014 by Abhinav S
Just remember, keep the screen / view and database data separate.Let the controller work on on the mediator between the model and the view.
16 Mar 2014 by Abhinav S
TryJoin Query using Entity FrameWork[^]Left Outer Join extension for Entity Framework[^]
20 Mar 2014 by Abhinav S
Try the following links -N-Tier development with ASP.NET MVC, WCF, and LINQ[^]A N-Tier Architecture Sample with ASP.NET MVC3, WCF, and Entity Framework[^]Accessing a WCF Service in an ASP.Net MVC Application[^]How to use WCF and MVC as Client [^]Host WCF service library in ASP.NET MVC...
30 Mar 2014 by Abhinav S
This error occurs when you access a property of an object that is null.As a basic step, ensure you check for nulls before accessing properties of objects.This however, may suppress the error butmay not help you solve the problem.For this ensure, your connection is correctly...
1 Apr 2014 by Abhinav S
Tryhttp://aspsolutionkirit.blogspot.in/2013/08/example-of-inline-edit-and-update-in.html[^]http://www.webcodeexpert.com/2013/11/aspnet-mvc-application-to.html[^]http://aspdotnet-kishore.blogspot.in/2013/10/mvc4-razorhow-to-call-stored-procedure.html[^]
10 Apr 2014 by Abhinav S
Try using a loop as follows@for(var i = 0; i
18 Apr 2014 by Abhinav S
There are some books available - http://www.amazon.com/Exam-Ref-70-486-Developing-Applications/dp/0735677220[^].
26 May 2014 by Abhinav S
Facebook API available here - https://developers.facebook.com/[^].Some other links -Simple .NET MVC 3 web application with integrated Facebook OAuth...
7 Jul 2014 by Abhinav S
A view is not a form.You can have as many partial views as you want.
26 Aug 2014 by Abhinav S
Assuming you are using forms authentication, there is no major drawback in this method.Try using System.Web.HttpContext.Current.User.Identity.IsAuthenticated in that case.