SlideShare a Scribd company logo
Working with ASP.NET
MVC and AJAX
Brij Bhushan Mishra
Who am I?
Brij Bhushan Mishra
Microsoft MVP ASP.NET/IIS (2011, 2012, 2013)
Mind Cracker MVP
Former Code Project MVP
Blogger/Author/Speaker
http://brijbhushan.net
@brij_bhushan
brij.mishra@outlook.com
Agenda
 Introduction
 Raw Ajax with MVC
 Multiple AJAX Options
 Rendering Partial Page with AJAX
 Using AJAX Helpers
 Using jQuery AJAX
 Error handling with AJAX
 JSON and MVC
 WCF, MVC and AJAX
 Conclusion
Why Ajax
 Rich interface
 No Postback or full page refresh
 Better experience
 Can be animated
 Less bandwidth
 Less response time
 Harder to debug
Raw AJAX
- An event occurs
- Create
XMLHTTPRequest
object
- Send
HTTPrequest
- Process
HTTPRequest
- Create response
and send back to
client
- Process the
result content
- Update the UI
Raw AJAX contd..
Property Description
onreadystate
change
Stores a function (or the name of a function) to be called
automatically each time the readyState property changes
readyState
Holds the status of the XMLHttpRequest. Changes from 0 to
4:
0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready
status
200: "OK"
404: Page not found
Ajax Options
 Microsoft AJAX
 Component structure
 OOPs concept
 Executes over CLR
 Easy support for WCF and JSON
Ajax Options contd..
 jQuery Ajax
 Available as Plug in
 Many other jQuery plugin can be used
 Easy CSS selectors
 Easy DOM manipulation
Ajax Helpers
 Can create links which sends the ajax request when clicked or even
Ajax Options
 Many events included like
 OnBegin
 OnComplete
 OnFailure
 OnSuccess
 Confirmation Prompt
 Processing image
Ajax and Partial View
 Partial views can be loaded by using AJAX helpers
Ajax and Partial View contd..
 Use jQuery Ajax to load Partial Views
Error Handling with Ajax
 Proper error handling is required to show a proper message
 Error handling with AJAX helper
 Error Handling with jQuery AJAX
JSON and ASP.NET MVC
 To return result in JSON format return JsonResult from controller action
 Both jQuery and Micorsoft works with JSON
MVC-AJAX-WCF
 Integrating WCF, AJAX and ASP.NET MVC
Demo
Conclusion
Thank You

More Related Content

PDF
PPTX
ASP .NET MVC - best practices
PPTX
Introduction to ASP.NET MVC
PPTX
ASP .NET MVC
PDF
MVC 1.0 als alternative Webtechnologie
PPTX
Angular on ASP.NET MVC 6
PPTX
Getting started with MVC 5 and Visual Studio 2013
PPTX
ASP.NET MVC 5 - EF 6 - VS2015
ASP .NET MVC - best practices
Introduction to ASP.NET MVC
ASP .NET MVC
MVC 1.0 als alternative Webtechnologie
Angular on ASP.NET MVC 6
Getting started with MVC 5 and Visual Studio 2013
ASP.NET MVC 5 - EF 6 - VS2015

What's hot (20)

PPTX
Modern Applications With Asp.net Core 5 and Vue JS 3
PDF
React.js - and how it changed our thinking about UI
PPTX
ASP.NET Brief History
PPTX
Introduction of ASP.NET MVC and AngularJS
PPTX
Single Page Applications on JavaScript and ASP.NET MVC4
PPT
ASP.NET 4.0 Roadmap
PDF
Server rendering-talk
PDF
ASP.NET Overview - Alvin Lau
PPTX
PDF
Progressive Web Apps
PDF
ASP.NET MVC 3
PPTX
Harish Understanding Aspnet
PDF
Dot net interview questions and asnwers
PPTX
Spicing up SharePoint web parts
PPT
ASP .net MVC
PPTX
Ajax assignment help
PPTX
Introduction to ASP.NET MVC
PPTX
Walther Ajax4
PPT
Ajax & ASP.NET 2
PPTX
Harish Aspnet Deployment
Modern Applications With Asp.net Core 5 and Vue JS 3
React.js - and how it changed our thinking about UI
ASP.NET Brief History
Introduction of ASP.NET MVC and AngularJS
Single Page Applications on JavaScript and ASP.NET MVC4
ASP.NET 4.0 Roadmap
Server rendering-talk
ASP.NET Overview - Alvin Lau
Progressive Web Apps
ASP.NET MVC 3
Harish Understanding Aspnet
Dot net interview questions and asnwers
Spicing up SharePoint web parts
ASP .net MVC
Ajax assignment help
Introduction to ASP.NET MVC
Walther Ajax4
Ajax & ASP.NET 2
Harish Aspnet Deployment
Ad

Similar to ASP.NET MVC and ajax (20)

PPTX
Walther Aspnet4
PPT
Ajax Frameworks in the J(2)EE Environment
PPT
ASP.NET AJAX with Visual Studio 2008
PPT
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
PPTX
Ajax and ASP.NET AJAX
PPTX
React JS .NET
PPTX
ASP.NET MVC From The Ground Up
PPT
SynapseIndia asp.net2.0 ajax Development
PPT
Using Ajax In Domino Web Applications
PPT
mukesh
PDF
Build your website with angularjs and web apis
PPTX
Jsf presentation
PDF
Effective JavaFX architecture with FxObjects
PPT
PPT
Asp.Net Ajax Component Development
PPT
Ajax and PHP
PPT
Asynchronous JavaScript & XML (AJAX)
PPT
Ajax: User Experience
Walther Aspnet4
Ajax Frameworks in the J(2)EE Environment
ASP.NET AJAX with Visual Studio 2008
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Ajax and ASP.NET AJAX
React JS .NET
ASP.NET MVC From The Ground Up
SynapseIndia asp.net2.0 ajax Development
Using Ajax In Domino Web Applications
mukesh
Build your website with angularjs and web apis
Jsf presentation
Effective JavaFX architecture with FxObjects
Asp.Net Ajax Component Development
Ajax and PHP
Asynchronous JavaScript & XML (AJAX)
Ajax: User Experience
Ad

Recently uploaded (20)

PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Approach and Philosophy of On baking technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Machine Learning_overview_presentation.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
August Patch Tuesday
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
NewMind AI Weekly Chronicles - August'25-Week II
gpt5_lecture_notes_comprehensive_20250812015547.pdf
OMC Textile Division Presentation 2021.pptx
Programs and apps: productivity, graphics, security and other tools
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Network Security Unit 5.pdf for BCA BBA.
Approach and Philosophy of On baking technology
Advanced methodologies resolving dimensionality complications for autism neur...
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Empathic Computing: Creating Shared Understanding
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Univ-Connecticut-ChatGPT-Presentaion.pdf
A comparative study of natural language inference in Swahili using monolingua...
Getting Started with Data Integration: FME Form 101
Machine Learning_overview_presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Heart disease approach using modified random forest and particle swarm optimi...
August Patch Tuesday

ASP.NET MVC and ajax

  • 1. Working with ASP.NET MVC and AJAX Brij Bhushan Mishra
  • 2. Who am I? Brij Bhushan Mishra Microsoft MVP ASP.NET/IIS (2011, 2012, 2013) Mind Cracker MVP Former Code Project MVP Blogger/Author/Speaker http://brijbhushan.net @brij_bhushan [email protected]
  • 3. Agenda  Introduction  Raw Ajax with MVC  Multiple AJAX Options  Rendering Partial Page with AJAX  Using AJAX Helpers  Using jQuery AJAX  Error handling with AJAX  JSON and MVC  WCF, MVC and AJAX  Conclusion
  • 4. Why Ajax  Rich interface  No Postback or full page refresh  Better experience  Can be animated  Less bandwidth  Less response time  Harder to debug
  • 5. Raw AJAX - An event occurs - Create XMLHTTPRequest object - Send HTTPrequest - Process HTTPRequest - Create response and send back to client - Process the result content - Update the UI
  • 6. Raw AJAX contd.. Property Description onreadystate change Stores a function (or the name of a function) to be called automatically each time the readyState property changes readyState Holds the status of the XMLHttpRequest. Changes from 0 to 4: 0: request not initialized 1: server connection established 2: request received 3: processing request 4: request finished and response is ready status 200: "OK" 404: Page not found
  • 7. Ajax Options  Microsoft AJAX  Component structure  OOPs concept  Executes over CLR  Easy support for WCF and JSON
  • 8. Ajax Options contd..  jQuery Ajax  Available as Plug in  Many other jQuery plugin can be used  Easy CSS selectors  Easy DOM manipulation
  • 9. Ajax Helpers  Can create links which sends the ajax request when clicked or even
  • 10. Ajax Options  Many events included like  OnBegin  OnComplete  OnFailure  OnSuccess  Confirmation Prompt  Processing image
  • 11. Ajax and Partial View  Partial views can be loaded by using AJAX helpers
  • 12. Ajax and Partial View contd..  Use jQuery Ajax to load Partial Views
  • 13. Error Handling with Ajax  Proper error handling is required to show a proper message  Error handling with AJAX helper  Error Handling with jQuery AJAX
  • 14. JSON and ASP.NET MVC  To return result in JSON format return JsonResult from controller action  Both jQuery and Micorsoft works with JSON
  • 15. MVC-AJAX-WCF  Integrating WCF, AJAX and ASP.NET MVC Demo