articles

Home / DeveloperSection / Articles / Fetching Record From Database By Using Ajax in MVC

Fetching Record From Database By Using Ajax in MVC

Niraj Kumar Mishra1897 22-Aug-2017
 I am using this Example with the help of Mvc 4 application

Step 1: Create a Controller like "HomeController"..and in this Controller you create Index Action method and Some other action method that are given below in Screen Shot..
Fetching Record From Database By Using Ajax in MVC

Step 2: Now you right click on Index method side and create an Empty View and
Write Some Code that is given below.
Index.cshtml
Fetching Record From Database By Using Ajax in MVC

Step 3: Now You create a Partial View on Views->Shared-> _partial.cshtml, with Strongly Type like this..

Fetching Record From Database By Using Ajax in MVC

and click on  Add Button. Then Your _Partial view looks like this..

Fetching Record From Database By Using Ajax in MVC
Fetching Record From Database By Using Ajax in MVC
Now, Your Application Is Ready to Run , and in this Application Your page are not be "Refreashed" any time..
Output are : 

Fetching Record From Database By Using Ajax in MVC

When You Click on TheAllLink then it show the following Result:-

Fetching Record From Database By Using Ajax in MVC
and Again if You Click on The Top3 Link then it show the following Result:-

Fetching Record From Database By Using Ajax in MVC

and Again if You Click on The Bottom3 Link then it show the following Result:-

Fetching Record From Database By Using Ajax in MVC
These result are show on the basic of Emp_Id.
I hope you you are understand this example...



 
 


Updated 07-Sep-2019

Leave Comment

Comments

Liked By