Skip to main content

Posts

Implement paging in Asp.net MVC using PagedList library

Introduction :  In this article, I will explain How to implement paging using PagedList library in Asp.net MVC. Step 1:  Open visual studio  à  Go to File menu  à select New  à  Project like as shown below Step 2:  Now from web templates select  Asp.Net Web Application  ( .NET Framework ) and give name ( PagingInMVC ) to the project and click  OK  button like as shown below. Step 3:  Once we click  OK  button new template will open in that select  MVC  from templates like as shown below Step 4: Our project structure will be like as shown below step 5: Delete the HomeController already present in the project because we will create it from scratch as shown below Step 6: Delete the Home folder inside Views folder as shown below Step 7 : Click on Models -> Add ->New Item as shown in below Step 8: Select Data -> ADO.NET Entity Data Model and...
Recent posts

minDistance

Write a function named   minDistance   that returns the smallest distance between two   non-trivial   factors of   a number. For example, consider   63. Its   non-trivialfactors are 3,   7, 9   and 21. Thus   minDistance (63) would return 2 because the   smallest distance between any two   non-trivial factors is 2 (9 - 7   = 2).   As another example,   minDistance   (25) would return 0   because   25 has only   one   non-trivial   factor:   5. Thus   the smallest distance   between any two   non-trivial   factors is 0   (5   -   5 = 0).   Note that   minDistance (11)   would return -1 since 11 has no non-trivial factors. The function signature is    int   minDistance (int n)  Solution :        public static int minDistance ( int n) { int minDist = n, co...

Daphne array

Question : A  Daphne array  is an array that contains either all odd numbers or all even numbers. For example, {2, 4, 2} (only even numbers) and {1, 3, 17, -5} (only odd numbers) are Daphne arrays but {3, 2, 5} is not because it contains both odd and even numbers. Write a function named  isDaphne  that returns 1 if its array argument is a Daphne array. Otherwise it returns 0. If you are programming in Java or C#, the function prototype is    int isDaphne (int[ ] a); If you are programming in C or C++, the function prototype is    int isDaphne (int a[ ], int len) where len is the number of elements in the array. Solution : public int isDaphne ( int [] a) { bool isEven = false , isOdd = false ; for ( int i= 0 ;i<a.Length;i++) { if (a[i]% 2 == 0 ) { isEven = true ; } else { ...

wave array

A   wave   array   is defined to an array which does   not   contain   two even numbers   or two odd numbers in adjacent locations. So {7, 2, 9, 10, 5}, {4, 11, 12, 1, 6},   {1, 0, 5} and {2} are all   wave arrays . But { 2, 6 , 3, 4} is not a   wave   array because the even numbers 2 and 6 are adjacent to each other.   Also   {3, 4, 9, 11, 8}   is not a wave array because the   odd   numbers   9   and   11   are adjacent to each other.   You can assume array has at least one element.            Write a function   named   isWave   that returns 1 if its array argument is a   Wave   array, otherwise it returns 0. If you are programming in Java or C#, the function signature is    int isWave   (int [ ] a) If you are programming in C or C++, the function signature is    int is...