Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Preface

Preface

The jQuery library has become increasingly popular with web application developers because of its simplicity and ease of use. The library is supported by an active community of developers and has grown significantly over the years after its inception in 2006 by John Resig. Using this library eases complicated tasks and adds to the interactive experience of the end user. Its extensible plugin architecture enables developers to build additional functionalities on top of the core library.

With Microsoft's contribution of Templates, DataLink, and Globalization plugins to the jQuery library and the distribution of jQuery with Visual Studio 2010 onwards, the library has gained popularity with ASP.NET developers. jQuery can be very easily interfaced with ASP.NET controls as well as custom user controls. It can be used to validate controls using client side scripts, thus giving us an alternative for server side Validation Controls. It can be used to incorporate cool animation effects as well as to create graphic-rich pages. It can be used to post AJAX requests to web services, page methods, and HTTP handlers. The possibilities with jQuery are endless.

This cookbook aims to cover some of the day-to-day tasks faced by ASP.NET developers and how jQuery can be applied to work out the same. We will be focusing on interfacing jQuery with ASP.NET applications and some of the amazing tasks that can be accomplished using this powerful library. The recipes described in this book give fast and easy solutions to some of the common encountered problems in web applications.

What this book covers

Chapter 1, Working with ASP.NET Controls, describes the interfacing of standard ASP.NET controls with the jQuery library. Controls such as TextBox, CheckBoxList, DropDownList, and Hyperlink are covered in this chapter.

Chapter 2, Validation of ASP.NET Controls, explains different client side validation techniques that can be used with jQuery for validation of ASP.NET controls. These validation techniques provide a substitute for server side Validation Controls.

Chapter 3, Working with GridView Control, explores different manipulations that can be applied to the ASP.NET GridView control. You will learn to highlight rows/cells, remove rows/cells, use plugins, and apply animation effects using scripts.

Chapter 4, Working with Image Control, describes interesting applications of jQuery with the ASP.NET Image control. The recipes covered demonstrate handy utilities such as zooming, cropping, swapping, and changing the opacity of images. You will also learn to build a photo gallery using jQuery.

Chapter 5, Animations in ASP.NET, looks into various interesting animation effects that can be achieved using jQuery. You will learn to apply different types of animation effects to ASP.NET Label, Image, and Panel controls. Various effects such as fading, sliding, enlarging, and so on are covered in this chapter. The chapter also demonstrates animation chaining and prevention of animation queue buildup.

Chapter 6, AJAX and ASP.NET (Part 1), demonstrates the making of AJAX calls using jQuery. The chapter describes three basic techniques of sending AJAX request to the server: via page methods, web services, and HTTP handlers. The chapter also demonstrates the use of the Firebug add-on in Mozilla Firefox browser to investigate the AJAX request/response.

Chapter 7, AJAX and ASP.NET (Part 2), explores more advanced applications of jQuery AJAX. The recipes in this chapter show how to work with HTML, XML, script, JSON, JSONP, and complex data types such as objects using AJAX. You will also learn to build a search engine using Yahoo! Search API.

Chapter 8, Client Templating in ASP.NET, explains the use of Microsoft's jQuery Templates plugin in ASP.NET websites. The chapter covers both inline as well as external templates.

What you need for this book

You will need to use the jQuery library and Visual Studio (2005 and above) to work out the examples described in this book. Some of the recipes also require the download of jQuery plugins. The source code included with the book is based in C#.

Who this book is for

This book is for ASP.NET developers wanting to learn the nitty-gritty of interfacing jQuery with ASP.NET applications. The expertise level ranges from basic to advanced.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Create a new ASP.NET website Chapter1 in Visual Studio 2010."

A block of code is set as follows:

<body>
<form id="form1" runat="server">
<! -INCLUDE ASPX MARKUP HERE-- >
</form>
</body>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

.defaultText
{
font-style:italic;
color:#CCCCCC;
}

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Add a TextBox field with a Search button to the form".

Warnings or important notes appear in a box like this.


Tips and tricks appear like this.


Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to feedback@packtpub.com, and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail suggest@packtpub.com.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books maybe a mistake in the text or the code we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt Publishing, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at copyright@packtpub.com with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at questions@packtpub.com if you are having a problem with any aspect of the book, and we will do our best to address it.