Click here to Skip to main content
15,894,180 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 Feb 2024 by Richard Deeming
The error message is slightly confusing, but once you see it, the problem is obvious: Quote: Please specify one of either an InputStream or a FilePath to be PUT as an S3 object. The error is telling you that you have specified both an...
15 Feb 2024 by itsathere
File.WriteAllBytes("D:/" + model.FileBase.FileName, model.FileBase.Data); byte[] bytes = Convert.FromBase64String(model.file); using (var inputStream = new MemoryStream(model.FileBase.Data)) { ...
27 Jan 2024 by OriginalGriff
To add to what has been said ... never try to throw "millions of records" into any kind of UI - it's slow, memory hogging, bandwidth slogging, and worse completely useless in practice because the user cant find the row he is interested in this...
27 Jan 2024 by M Imran Ansari
You probably don't need to load millions of records all at once, instead use paging and fetch from database paged. Here are the link to provide you step by step guide with example to implement pagination in your project. jQuery DataTables and...
27 Jan 2024 by Member 12032971
Dear , I want to show millions of record in table front design view in mvc but because of large amount of records is there and in table design is get stuck and show error outofrange. Kindly guide me in mvc to resolve my point. What I have...
8 Jan 2024 by Member 16179425
# import the module import tweepy # assign the values accordingly consumer_key = "" consumer_secret = "" access_token = "" access_token_secret = "" # authorization of consumer key and consumer secret auth =...
27 Dec 2023 by codiagirl
I have a child view name UploadImage and parent view name CROCOnfig, when I access child view by using button in parent view,it works fine, but when I try to render child view in parent view,it throws error that model is null. I have placed child...
22 Dec 2023 by FirdousNasreen
$(document).ready(function () { $("#AmountId").change(function () { var a =...
24 Oct 2023 by codiagirl
I want to disable double click and allow only single click. I have tried the following code, but it did not work. What's wrong here. I am working in mvc Razor syntax. What I want is, when user clicks on Save letter button, it saves the letter,...
19 Oct 2023 by Dave Kreskowiak
You can just handle the dblclick event and not do anything with it. Test! const btn = document.querySelector("#testBtn"); ...
19 Oct 2023 by M Imran Ansari
To prevent a double-click action, you should disable the button on the first click and then re-enable it after a certain delay. Here is an example of how you can modify your code to achieve this functionality:
9 Oct 2023 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email...
9 Oct 2023 by Graeme_Grant
Still unsure which line is throwing the error... The full error message with stack trace would identify where the error occurred. Have you set a breakpoint and check the line with the error? At a guess, report.InCorrectMapping &/or...
9 Oct 2023 by musfirah hamid
I have 2 accounts one is confirm and other one is unconfirm. whe user click on reportComparison button, it shows data of both accounts. if user think data is wrong he can change it from available dropdowns,dropdown is also on the same page. and...
8 Aug 2023 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Check out my blog - EntityType: EntitySet ‘[Entity Name]’ is based on type ‘[Entity Name]’ that has no keys defined[^]
25 Jul 2023 by programing pro
It is a control that is used to create a hyperlink. It responds to a click event. We can use it to refer any web page on the server. To create HyperLink either we can write code or use the drag and drop facility of visual studio IDE. This...
10 Jul 2023 by RashaSalim
OK I'v researched and tried every single suggestion (individually of course) before posting this and I hit a wall every time This is my log in view I used ViewBag to pass the ReturnUrl value as I've seen in many answers to this problem Login @using...
4 May 2023 by Ajithkumar.S
I have a legacy application in asp.net web forms and I would like to convert it into asp.mvc. I am using SQL server session state. Currently, I am planning to convert page by page, this means both web forms and mvc pages co exist in the...
4 May 2023 by Richard Deeming
Use the .NET Upgrade Assistant[^] to do a side-by-side incremental upgrade. Upgrading your .NET projects with Visual Studio - .NET Blog[^] Migrating from ASP.NET to ASP.NET Core with Project Migrations Part 5 - .NET Blog[^] This will use the...
2 Mar 2023 by Member 13759771
how can i implement apply to a particular job by a user using mvc without using entity framework? What I have tried: i have tried to fetch user data from session but i dont how can i store that user data and job id to db table when i click...
2 Mar 2023 by Sandeep Mewara
Well, your query is more around how to use MVC without using Entity Framework behind the scenes. Entity Frameworks are not a mandatory way to interact with database. You can always use your own way to connect. Following articles would help you...
28 Feb 2023 by Member 15938200
เถียงไม่ได้เลยว่าปี 2022เป็นปีของการหาเงินกับเกมgame slot เพราะเหตุว่าเป็นเกมที่เล่นแล้วสนุก ลุ้นมัน พร้อมกับการหาเงินไปพร้อมๆกันได้อีกด้วย ดังนั้นวันนี้ทาง Sloteasy168 จะมาชวนเปิดประสบการณ์ดีๆกับการเล่น เว็บสล็อตแตกง่าย 2022 ไม่ผ่านเอเย่นต์...
25 Jan 2023 by Deepak Kanswal Sharma
Hello All,I'm Trying to upload Image with other details along with other details , but it gives me this error :-String[4]: the Size property has an invalid size of 0.Stored Procedure is:-ALTER proc [dbo].[spInsertPageDetail]@Heading varchar(100),@Body varchar(2000),@Img...
13 Jan 2023 by patel bina
I just added an SSL to my site. When I go to https://mydomain.com I see the text but no CSS or images are there. It is on a dedicated server and I have a full control of the code. All paths currently are relative. I can view images and css when...
20 Nov 2022 by Member 12183079
Dear sir I write code where I bind dropdown and take div and button when click on button then 4 control open using jquery so i want to know how to bind dynamic dropdownlist when i append in jquery i want to bind same dropdown where i take in strongly type dropdownlist in mvc please help What...
15 Aug 2022 by GrpSMK
I need to send an particular page url link(local host login page) to an email address(typed in textbox).If user clicks the submit button the url link need to be send the respected email id ,in encrypted format.I already done as a normal link,but need to send an encrypted link. Note: all i need...
25 Jul 2022 by Adam Jones
How Can i make the EditorFor input disabledi have tried using the below which doesn't work@Html.EditorFor(model => model.TaskName, new { disabled = "disabled", @readonly = "readonly" })
25 Jul 2022 by Member 15717891
@Html.EditorFor(model => model.Issued_CreatedBy, new {htmlAttributes = new { disabled = true, @class = "form-control ", @Value = Session["Username"] } })
18 Jul 2022 by OriginalGriff
Answered only to remove from unanswered queue: brought to top by spammer 7 years after first posting.
18 Jul 2022 by Sathish km
function AllcarDetails() { $.ajax({ type: "GET", url: "http://localhost:63461/api/CarDetails", dataType: "json", success: function (data) { //alert(this.url) var grid = $('#grid').kendoGrid(); ...
23 Feb 2022 by Jineesh TR
Hi all, I have a table that contains a column of external website addresses. I need to list those websites in a table, and I did it. But what I want is, when I click on this link, the control should be transferred to the specified website in a...
18 Feb 2022 by ahmed_sa
Problem when remove course then click submit not save changes although it removed from client side by jquery Details in edit view for every employee i need to do changes by remove or add new courses for employee if i add new courses then...
23 Jan 2022 by Member 15435636
When I try to add a view, an error message pops up saying "Arithmetic operation resulted in an overflow" What I have tried: I've unsuccessfully tried rebooting my PC, restarting and updating Visual Studio Community 2022
23 Jan 2022 by M Imran Ansari
Quote: This issue already reported for fixation. Kindly open your Visual Studio in Admin mode to avoid this exception. I would suggests open as Admin by default. To open you Visual Studio in Admin mode, open VS installed folder. Right click on...
23 Jan 2022 by Member 10163600
I have the same problem with VS2022 Community. Released version. It's an MVC4 project.
6 Nov 2021 by demouser743
I am saving the file content by converting to ToBase64String to my database. The file can be any type like image or excel or word or pdf and so on. Now I would like to view the file upon clicking the view icon. I did some research and found this ...
6 Nov 2021 by Dave Kreskowiak
You have to convert the Base64 string back to the original file data before you send it back to the browser. Frankly, why are you even converting it to Base64 representation when databases can store blob data? Converting to Base64 just makes the...
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 Oct 2021 by Richard Deeming
Whatever type is returned by your JtContrAssignmentInfo method - which you haven't shown - it doesn't implement either IEnumerable or IQueryable. You either need to return a type which implements one of those interfaces, or provide your...
22 Sep 2021 by saifulhaque
Hi, I am working Web api project.Bearer API token generation working is fine and authetication also working fine.If one user generated Bearer token and expires 90 days .When he generate another token both is working .How we can stop previous...
22 Sep 2021 by mirajanata
Hi, I would - create a token blacklist and check the tokens against it during authentication/authorization process. - remove the tokens from the blacklist once they expired (using background thread) Mira
7 Sep 2021 by saifulhaque
I am trying to convert API ‘expires_in’ time of bearer token getting wrong result. Please look at the code what I tried and please help me to get correct result I am using visual studio 2015 and MVC4 . What I have tried: public DateTime...
7 Sep 2021 by Richard Deeming
The expires_in value represents the number of seconds until the token expires. You need to add that to the current date/time, not to the Unix timestamp base date. DateTimeOffset expiresAbsolute = DateTimeOffset.UtcNow.AddSeconds(7775999); //...
10 Aug 2021 by Heba Kamel
Hi, I am trying to send mail from gmail and it's sent successfully in localhost but when publish website on server didn't send any help here?it's my code MailMessage mail = new MailMessage(); mail.Subject = strSubject; mail.From = new...
5 Aug 2021 by Ashutoshkrsingh
I have 1 mvc application and that is running fine on 2 url's with the same code deployed to different folder for both the url's to work. URL's are like https://www.abc.com/ - web form authentication https://www.abc.com/AD/ - windows...
5 Aug 2021 by Richard Deeming
You'll need a Windows Authentication action on your Home controller: [Authorize] [Route("AD")] public ActionResult WindowsLogin(string returnUrl = null) { FormsAuthentication.SetAuthCookie(User.Identity.Name, false); if...
4 Aug 2021 by Member 15312752
I was facing this error because of column name in table and properties name in the entity class were not matching.Ensure that table name is either matching or you are using table attribute in case table name and entity class name is not...
4 Aug 2021 by jay49
One or more validation errors were detected during model generation:mvcstarted.Models.employee: : EntityType 'employee' has no key defined. Define the key for this EntityType.employees: EntityType: EntitySet;employees; is based on type;employee; that has no keys defined.public...
2 Jul 2021 by Member 11025896
Hi There, I have and edmx file and I want to generate all tables, store procedure, and view which is present in edmx file into sql server database. Can anyone help me to solve this problem What I have tried: I have tried "Generate Database...
1 Jul 2021 by OriginalGriff
Quote: I have tried "Generate Database From Model" tool but it will generate only tables and it does not generate store procedures and views in sql server which is present in edmx, why? Ask the people who created the tool - there are several...
29 Jun 2021 by OriginalGriff
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself. Let me just explain what the error means: You have tried to use a variable, property, or a...
20 Jun 2021 by Faisalabadians
HI, can any one know how to set ViewBag property in javascript? I am using this code@{ ViewBag.Pid = @:Pid}where @:Pid is javascript variable and have value in it, but the code is not working and giving syntax error.
20 Jun 2021 by Lerroo
View bag is not intended for this use DTO models.
14 Jun 2021 by Patrick Skelton
It seems the answer to this is extremely simple. Publish to a local folder on your machine and then use FTP to put the contents of this folder on the web server. I have an excellent program called SyncBackSE which will watch a directory for...
14 Jun 2021 by Patrick Skelton
I have newly created an MVC.NET application using the template in Visual Studio 2019. This runs fine in my local IIS (built into VS) but when I deploy to my live server, I get a couple of 500 errors. The offending files are an image that I have...
9 Jun 2021 by Lalo Miguel
I have this in my controller for both logging in and logging out In this part I am creating the part so that the user can log in through permissions [HttpPost] public ActionResult Login(registro model, string returnUrl) { try ...
9 Jun 2021 by Richard Deeming
Basically, you don't. All modern browsers have built-in password managers. The user can choose to save their password when they sign in, and let the browser's password manager fill in their username and password when they come back. Any attempt...
23 Mar 2021 by imaa2amha
Dear All,I am tring to return list of object such as :List Mails = FillList();return Mails;where Mail class look like:public class Mail{public int Mail_ID { get; set; }public string MailName { get; set; }public string MailHeader { get; set; }public string...
23 Mar 2021 by tiraxes
this solution worked for me: WCF - How to control the name spaces generated by web service in soap xml[^]
21 Feb 2021 by Member 15079730
I am using Asp.NET Mvc frame work. WIth my code I am trying to show data week wise on Chart. I am fairly new to Chart, and also new to GroupBy Week Wise Data. Kindly share yous help so that I can generate Report for Data as per Week
12 Jan 2021 by Member 11644373
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MVC1.Models; namespace MVC1.Controllers { public class customer { public string customername { get; set; } public string address { get; set; } public...
1 Dec 2020 by Mukesh Ghosh
Hello,I am using a MVC Razor View , now i would like to stop Auto complete option for Password Field. So far i am using autocomplete="off" but not working in crome.Can anyone please help me on this ?
1 Dec 2020 by Hardy Vadher
Place below code above your username control. This will work in call the browser.
25 Nov 2020 by Heba Kamel
Hi, I have a form @using (Html.BeginForm("Upload", "Upload", FormMethod.Post, new { enctype = "multipart/form-data" })) { @Html.ValidationSummary(true) program Programe Name : ...
13 Oct 2020 by sasko1
Hi! I have modal boostrap div that is called by action on button click. I want to be able to redirect user to login div when user tries to perform action he is not authorised to do. Can you give me some good resource so i could try to figure it...
13 Oct 2020 by Sandeep Mewara
Believe following is what you are trying, a CP article: Use Twitter Bootstrap Modal Dialog for Smoother Login Experience[^]
22 Sep 2020 by dipak _kansara
Hi,I am having problem while post large amount of data in ajax requestCheck Below Code var jsonPostData = { p_HTML: $("#div").html(), p_FromDate: $("#dpFrom").val(), p_ToDate: $("#dpTo").val() } $.ajax({ url: "url", ...
22 Sep 2020 by Edwinjvo
Es Así como se configura en el web.config
15 Sep 2020 by RAHUL(10217975)
Hello, Requirement is user will upload an excel file with students names and other data. After uploading, on same click event user should get an excel file stating row by row status whether student data created successfully or any error message....
15 Sep 2020 by Richard Deeming
Avoid using Response.BinaryWrite in MVC. Use a custom ActionResult instead: public class ExcelResult : FileResult { private const string MimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; public...
14 Sep 2020 by Afzaal Ahmad Zeeshan
Quote: There were update on 1st module. I want to publish only 1st module, so that the remaining 2 modules users are not impacted. You are looking at the microservices architecture requirement here. Each service is a separate project, a separate...
14 Sep 2020 by chitranshi kulkarni
I want a solution, suppose I have 3 module In MVC application running on production, which are accessible by common menu. There were update on 1st module. I want to publish only 1st module, so that the remaining 2 modules users are not impacted....
25 Aug 2020 by Atul Singla
We can send cross domain AJAX requests using JSONP. Below is the simple JSONP Request: $.ajax({ type: "POST", url: "http://localhost:4046/Values/Mymethods", data: jsondata, dataType:...
25 Aug 2020 by Midhun T P
Hi All, I have a web api which has a Post method in it.So from another webpage i'm posting json data to this API using jquery ajax as below - $.ajax({ type: "POST", url: "http://localhost:4046/Values/Mymethods", data: jsondata, dataType: 'json' ...
12 Aug 2020 by nischalinn
I have model classes for budgeting system, public class BudgetModels { [Key] public int BudgetId { get; set; } public string BudgetName { get; set; } public decimal BudgetTotalAmount { get; set; } } public class ProjectModels { [Key]...
12 Aug 2020 by Garth J Lancaster
Well, a problem I might face is I dont know what records exist when .. lets say you have this record BudgetId BudgetName BudgetTotalAmount 111 Road-const 15,00,000 If you want to 'insert data for the next Project with BudgetId 111 you...
10 Aug 2020 by Sandeep Mewara
Either: 1. Resource designer.cs connection with your web.config file is not correctly setup OR 2. Designer file name has an extra dot Try the following: 1) Create Resource .resx file under any folder 2) set CustomTools =...
10 Aug 2020 by Member 14887481
Designer resx file remains empty after adding New Resource File What I have tried: 1) Hi There, I am working on a Globalization Project, For English Translation i have added default Resource.resx file. For other language(Japanese) i have...
9 Aug 2020 by soumyaraj
I have successfully implemented Angular 4 in to our MVC4 project using the following link and got successfully executed the angular welcome page. But when I try to create new component using ng command it says.. ng' is not recognised as an internal or external command, operable program or batch...
9 Aug 2020 by Navee-Shivam
After execution of the npm -g @angular/cli command go to path : C:\Users\\AppData\Roaming\npm There you can find the ng script file (type .cmd ) Copy the path Move on to Environment Variables 1) Right click of This PC 2) Advance...
7 Aug 2020 by silantmagicbbb
[HttpPost] public ActionResult CheckEmployee(Chart obj) { SqlConnection con = new SqlConnection(@"Data Source=MAHGOUBND4;Initial Catalog=CTC_Mahgoub;Persist Security Info=True;User...
7 Aug 2020 by Richard Deeming
Quote: [HttpPost] public ActionResult CheckEmployee(Chart obj) "ajax": { "url": "/chart/CheckEmployee", "type": "GET", "datatype": "json" }, Your action requires a POST request, and requires a Chart object as its parameter. Your...
6 Aug 2020 by Kasthuri Gunabalasingam
I need a way to set already selected values in a multi select dropdown in a edit view in a web application (ASP.NET, Mvc) from view code,I passed selected ids in to selected values array.(when I return values from DB , assign those in to a array then assign to here. I need a edit view by set...
6 Aug 2020 by Member 14790612
Um problema de 2017 resolvendo meu problema em 2020. Parabens Valeu!!
4 Aug 2020 by Dawood507
I am trying to pass array list of objects to mvc controller by using ngFileUpload because need to send some images with it. Client side app.controller('ProprietorController', function ($http, $scope, Upload) { var existRegDetailVals = [];...
4 Aug 2020 by Richard Deeming
It looks like your server is using a US locale, and expects dates to be formatted as MM/dd/yyyy, whereas you are passing them as dd/MM/yyyy. The three dates which work are ambiguous between the two formats, and in US format will be interpreted...
5 Jul 2020 by Hassan Aijaz
Hey Guys, So i need a suggestions and help. I have application in which i have 3 different login forms. 1 for SuperAdmin, 1 for SubAdmins, and 1 for normal users. I create 3 login forms for security purpose there is very sensitive information...
5 Jul 2020 by MadMyche
As Patrice stated; use 1 login page for all users. Here is a very basic Login processing script to give you the basic logic of how to do this. This is on the line of quasi-code; and should not be used for production[HttpPost] public ActionResult...
5 Jul 2020 by Patrice T
Quote: please tell me if there is any other better way Better way is 1 single login form ! Because you know who is a new user after the login. Quote: I create 3 login forms for security Don't want to be rude, but it looks like you don't really...
15 Jun 2020 by Member 14863691
below the attached solution work over local machine and server. string fromEmail = "from@gmail.com"; MailMessage mailMessage = new MailMessage(fromEmail, "to@gmail.com", "Subject",body); mailMessage.IsBodyHtml = true; SmtpClient smtpClient = new...
3 Jun 2020 by Randeep Chauhan
Hi All,I am working on MVC4 application.My current url is http://localhost:3251/product/sports/abc[^]product is my controller namesports is categoryabc is my item with in sports categorybut i want like thishttp://localhost:3251/sports/abc[^]how to solve it.Thanks...
15 May 2020 by Richard Deeming
.ToList returns a List[^]. The list's ForEach method[^] executes a specified action for each item in the list. It does not return anything. Therefore, you cannot assign the return value (which doesn't exist) of that method to your variable. ...
15 May 2020 by Member 13160027
I have to update list values with new values daily. the new value is listvalue+newvalue What I have tried: allPayouts = (from p in allPayouts where p.UserID == Paid.UserID select p).ToList().ForEach((p) => { ...
14 May 2020 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email...
3 May 2020 by Patrice T
Quote: Whenever a user scrolls beyond the div with data I am populating the next div data dynamically with ajax. Techniques exist to hide loading time most of the time. The trick is to load all visible divs +1. Then when user start to scroll...
3 May 2020 by kole_manas
I have a long-scrolling web page with many div elements. Each div element contains different sections of the page. For better performance i.e. for reducing the load time of the page I am only loading the first two div elements with data during...
28 Apr 2020 by Sinisa Hajnal
In one you have Sponsor_ID in the other Sponsor_Id C# is case sensitive...
28 Apr 2020 by Abood Alkreen
i have tow class when set new relation one to one display this error The ForeignKeyAttribute on property 'V_ID' on type 'adminSection.Models.The_Sponsor' is not valid. The navigation property 'Visitor' was not found on the dependent type...
26 Apr 2020 by DouglasHarris
I got it working. I did not have the exact same problem because my rendering looked OK. Regardless, I was getting the same error message for two different types of bad data entry. Pare to the solution was to hard code the error messages in the...