Monday, October 30, 2017

Display number of records per page in MVC

In this article I am going to explain how to Display number of records per page in asp.net MVC.

Description:
I am using Pagedlist.mvc package for pagination. I want to show number of records are showing per page. For example you have 100 records and page size is 10. When you are at page 1 show in footer Showing 1-10 of 100 and on page 2 Showing 11-20 of 100.

Implementation:
Model (Employee.cs)

Sunday, October 29, 2017

MVC : Compare password and confirm password

In this article I am going to explain how to compare password and confirm password in asp.net MVC.

Description:
When creating users in MVC application want users to enter strong password and re-enter password to confirm.
  
Implementation:
  
Model

Saturday, October 28, 2017

How to change page size using dropdownlist in asp.net MVC

In this article I am going to explain how to change page size using dropdownlist in asp.net MVC.

Description:
I am using Pagedlist.mvc package for pagination. In previous article I have explained How to customize the pager in MVC Pagedlist.  Now I want to change/set page size using dropdownlist in foreach loop.

Implementation:
I want to display list of employees.
Model (Employee.cs)

[Solved]: Error:40–could not open a connection to SQL server

In this article I am going to explain how to resolve the Error: 40 – could not open a connection to SQL server.

Description:
When I am trying to connect the Sql server, got an error:

Cannot connect to localhost. :
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that the SQL Server is configured to allow remote connections. (provided: Named Pipes Provider, error: 40- Could not open a connection to the SQL Server) (Microsoft SQL Server, Error: 2).

Friday, October 27, 2017

How to validate strong password in asp.net MVC

In this article I am going to explain how to validate strong password in asp.net MVC. 

Description:
Password ensure the security for confidential information/data which is stored on your system or online anywhere. If you use weak password, it allow hackers to get access easily. So we have to always force users to set strong password. In strong password user must one uppercase, one lowercase, one special and one numeric (number) character.


Implementations:
I am going to create users for application.

Friday, October 6, 2017

Custom Pager in MVC Pagedlist

In this article I am going to explain how to customize the pager in MVC Pagedlist.

Description:
I want to show total number of records and number records are showing out of total records. Change the pagesize using dropdown.

Implementation:

Model
  public partial class Employee
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public Nullable<int> Phone { get; set; }
        public Nullable<int> Salary { get; set; }
        public string Department { get; set; }
        public string ImagePath { get; set; }
        public string EmailId { get; set; }
    }