Posts

Showing posts from 2012

Dependency Injection

Image
Replace dependencies with Dependency Injection to make your classes easier to reuse and test. The dependency injection pattern, is one of the most popular design paradigms today. It facilitates the design and implementation of loosely coupled , reusable , and testable objects in your software designs by removing dependencies that often inhibit reuse. Dependency injection can help you design your applications so that the architecture links the components rather than the components linking themselves. Samples used for this presentation:  DI_Demo.zip

WCF Bindings - Overview

Image

Calling a Static Page Method using jQuery

If you do not plan to call a web method from multiple pages, don’t perform all the work of creating a separate web service. Instead, you can expose a static method from the same AJAX page calling the web method. 1..ASPX Page - DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns ="http://www.w3.org/1999/xhtml"> < head id ="Head1" runat ="server">     < title > Show Web Service Method title >     < script type ="text/javascript" src ="../Scripts/jquery-1.4.1.js"> script >     < script type ="text/javascript">         $(document).ready( function () {             $( "#btnGet" ).click( function () {                 $.ajax({                     type: "POST" ,                     dataType: "json" ,                     cont

Calling Web Services from the Client using jQuery

1. .ASMX page - Web Service Code: [ WebService (Namespace = http://tempuri.org/ )] [ WebServiceBinding (ConformsTo = WsiProfiles .BasicProfile1_1)] [System.ComponentModel. ToolboxItem ( false )] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services. ScriptService ] public class QuotationService : System.Web.Services. WebService     {         [ WebMethod ]         public string GetQuote()         {             List < string > quotes = new List < string >();             quotes.Add( "The fool who is silent passes for wise." );             quotes.Add( "The early bird catches the worm." );             quotes.Add( "If wishes were true, shepherds would be kings." );             Random rnd = new Random ();             return quotes[rnd.Next(quotes.Count)];         }     } 2. .ASPX Page - Calling web service using jQuery  

What Is jQuery?

jQuery is an extremely fast, lightweight JavaScript library that simplifies many aspects of client-side web development.You can use jQuery for almost any client-side functionality that you can think of—event handling,animations, drag-and-drop functionality, asynchronousweb service calls, and much more. Furthermore, jQuery supports a robust plug-in modelthat enables developers to write their own extensions to implement whatever functionality they want. There are already hundreds of powerful jQuery plug-ins available. jQuery is CSS3-compliant and works on almost all browsers—Internet Explorer 6.0+, FireFox 2+, Safari 3.0+, Opera 9.0, and Google Chrome. This means that you can write one set of code and not have to worry about handling the specifics of different browser implementations; each line of jQuery works exactly the same on all browsers.The jQuery library is used on an incredible number of popular websites. Google, Dell, Bank of America, Digg.com, Netflix, WordPress, and even th