I want to show user details on User Profile using Session but it is not working any other way kindly suggest me, I’m using ASP.NET MVC. Login class: Dashboard controller: Screenshot of output: Answer When you use a session, that session is available throughout the site based on how long you have given it in the web config file. And
Tag: asp.net-mvc
How can I count total item in an object/record and count only the value = true
obj = {true, false, false , true,…}; This is only one record that I query from database by using Linq The reason is I would like to display Finsished 2 of 7 , that is why I need to count items in a record. Thank you in advance! After I can store numbers in variable, then I would like to
Datatables don’t load content of database
I’m trying to load users from a table in my database using datatables(https://datatables.net/) but the page is not loading anything at all. I’m getting these errors when I open the console [1]: https://i.stack.imgur.com/ykNTL.png I loaded the js and css here in this order: [uncaught ReferenceError: jQuery is not defined at dataTables.bootstrap.min.js:5 at dataTables.bootstrap.min.js:5][1] /> Answer if the page is not
How to connect sql Database with ado.net in Asp.Net Core Mvc 5.0?
I can not find where am i missing. my code like this ; users.cs : } usersAccessLayer.cs ; appsettings.json And finally i got this error; An unhandled exception occurred while processing the request. NullReferenceException: Object reference not set to an instance of an object. Adonet_Sql.Models.users..ctor() in users.cs, line 14 Adonet_Sql.Models.users..ctor() in users.cs bla bla. Answer ConfigurationManager.ConnectionStrings[“DefaultConnection”].ConnectionString; is for .net Core
How to compute running balance from array in ASP.NET MVC controller?
This is my code in controller I want to implement running balance in this array. This query will return Date, debit, credit and balance columns. I have to compute balance on the basis of debit and credit. I want to achieve this: for each row of the array. Hope, you get my point…help me….thanks Answer I have solved the problem.
A better way to obtain SQL data than I am currently using
I need to retrieve data from an external SQL Server database and view it (not store it) in my ASP.NET MVC application. The only way I can connect to the server is by using a server name, port number and access to a SQL Server stored procedure that the server owners provide. Currently the only way I know how to
Find rows that have the same value on a column in asp.net
I have an issue I want to translate this SQL query int asp.net. there is a relationship between student table and teacher table many to many and I want to display students that have more than one teacher and that what I trying to do in asp.net Answer You can try out both ways. Using Lambda Expressions Using SQL like
Data is retrieved but is not getting saved or updated ASP.NET Core 3.1
My questions is similar to this question but I’ve applied the answers and it’s still not working and I’ve used a slightly different approach while storing the data in the DB. Employee Model Class Type script code related to saving Save button View code Controller code related to Save When I click on save button it reloads the page without
SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint “FK_Register_Event”
I have three tables in SQL server; Event table: CREATE TABLE [dbo].[Event] ( [EventName] VARCHAR(25) NOT NULL, [Description] VARCHAR(60) NULL, [Location] VARCHAR(20) NULL, […
Parameters in ASP.NET MVC to create a PDF
I have a particular problem, I am working with ASP.NET MVC in C# and SQL Server. The idea is that on the main screen you see a text box and a button, entering a number that brings us our data. By bringing that data, the person can choose whether they want to see if that data in a PDF. But,