Guay Paz Telerik ASP.NET and Silverlight Controls THE EXPERT’S VOICE ® IN .NET Pro Telerik ASP.NET and Silverlight Controls Master Telerik Controls for Advanced ASP.NET and Silverlight Projects José Rolando Guay Paz Foreword by Joe Stagner Microsoft Companion eBook Available Go beyond traditional ASP.NET and Silverlight controls BOOKS FOR PROFESSIONALS BY PROFESSIONALS ® Pro Telerik ASP.NET and Silverlight Controls Dear Reader, Telerik has developed an extensive suite of components that substantially increase the power and flexibility of ASP.NET and Silverlight solutions. These components include reports, grids, charts, and text editing controls. With the vast number of configuration options and controls to choose from, under- standing how to apply these components within applications can be chal- lenging. I wanted to eliminate this challenge by presenting clear and detailed instructions on how to properly work with this toolset. All of the discussions and instructions in this book come from my own expe- rience working with Telerik controls in various solutions over the years. I dem- onstrate how to use features such as the RadEditor – a word processing control that allows for advanced interaction with text; the RadChart – a chart control that enables visually appealing rendering of data from a variety of data sources; and the RadAjaxManager – capable of translating PostBacks into AJAX calls. I also discuss recommended patterns and practices and focus attention on inter- control communication – a key part of any complex application. My goal is to provide you with as much information as I can in order to allow you to develop more effective and interesting Silverlight and ASP.NET applications. When I began writing this book, I was fortunate to have the opportunity to work closely with Telerik on the content and approach. They have endorsed this book, and see it as a valuable resource for the development community. I’ve put a lot of effort into the writing of this material, and I hope that you will enjoy reading it and will find it a useful guide to development with Telerik RadControls. José Rolando Guay Paz José Rolando Guay Paz US $59.99 Shelve in: Programming Languages / C# User level: Intermediate–Advanced THE APRESS ROADMAP Silverlight Recipes Pro Telerik ASP.NET and Silverlight Controls Pro ASP.NET 4 in C# 2010 Pro ASP.NET Server Controls in C# Pro Silverlight 3 in C# Beginning ASP.NET 4 in C# 2010 Beginning Silverlight 3 in C# www.apress.com SOURCE CODE ONLINE Companion eBook See last page for details on $10 eBook version Pro www.it-ebooks.info www.it-ebooks.info Pro Telerik ASP.NET and Silverlight Controls Master Telerik Controls for Advanced ASP.NET and Silverlight Projects ■ ■ ■ José Rolando Guay Paz www.it-ebooks.info Pro Telerik ASP.NET and Silverlight Controls: Master Telerik Controls for Advanced ASP.NET and Silverlight Projects Copyright © 2010 by José Rolando Guay Paz All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2940-7 ISBN-13 (electronic): 978-1-4302-2941-4 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. President and Publisher: Paul Manning Lead Editor: Mark Beckner Developmental Editor: Ewan Buckingham Technical Reviewer: Kevin Babcock Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Kelly Moritz Copy Editor: Heather Lang Compositor: Lynn L’Heureux Indexer: Brenda Miller Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer Science+Business Media, LLC., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. For information on translations, please e-mail rights@apress.com, or visit www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at www.apress.com. You will need to answer questions pertaining to this book in order to successfully download the code. www.it-ebooks.info To God for all the blessings I’ve received. Thank you Lord. To my beautiful wife Karina, my wonderful daughter Sara Nicole and our new baby coming soon. Thank you for being with me all the way with this project. I can’t thank you enough. I love you. I promise I’ll make up the time I stole from you. To my mother, Nelly, and father, Rolando, for teaching me all I needed. Dad, I know you are not with us anymore but this book is especially for you. I know you would’ve loved to see it. Thank you both for everything. I love you and miss you. To my sister Loly, my brothers Juan and Ramon, my nephews and nieces. I love you and miss you all. Thank you to my family in law for all your support and encouragement through all these years. Thank you. Special thanks to Aunt Maritza and to Uncle Marco. This never would have happened without them. www.it-ebooks.info www.it-ebooks.info ■CONTENTS v Contents at a Glance ■Foreword xviii ■About the Author xix ■About the Technical Reviewer xx ■Acknowledgements xxi ■Introduction xxii ■Chapter 1: Introducing ASP.NET and Telerik 1 ■Chapter 2: Getting Started With Telerik RadControls 15 ■Chapter 3: Input RadControls 33 ■Chapter 4: Navigation RadControls 61 ■Chapter 5: Date, T Time , and Scheduling RadControls 97 ■Chapter 6: Data RadControls, Part 1 131 ■Chapter 7: Data RadControls, Part 2 229 ■Chapter 8: Layout RadControls 281 ■Chapter 9: Chart and Image RadControls 329 ■Chapter 10: Additional RadControls 381 ■Chapter 11: RadAjax 421 ■Chapter 12: Telerik Extensions for ASP.NET MVC 499 ■Chapter 13: RadControls for Silverlight 531 ■Chapter 14: Introducing Telerik Reporting 585 ■Chapter 15: Telerik OpenAccess ORM 621 ■Index 661 www.it-ebooks.info www.it-ebooks.info ■CONTENTS vii Contents ■Foreword xviii ■About the Author xix ■About the Technical Reviewer xx ■Acknowledgements xxi ■Introduction xxii ■Chapter 1: Introducing ASP.NET and Telerik 1 ASP.NET 1 ASP.NET Web Forms 2 ASP.NET MVC 8 Telerik’s RadControls Suite of Components 13 Summary 14 ■Chapter 2: Getting Started With Telerik RadControls 15 Installing the Controls and Tools 15 Downloading the Installers 16 Installing the Suites 18 Installing Telerik Extensions for ASP.NET MVC 20 Installing and Updating Controls Manually 21 Setting Up Your Application to Use Telerik RadControls 22 Configuring Telerik RadCompression 27 Configuring Telerik RadUpload 28 Enabling RadScriptManager and RadStyleSheetManager 30 Summary 31 ■Chapter 3: Input RadControls 33 Introducing RadInput 33 Understanding Common Properties and Events 33 Using RadTextBox 36 www.it-ebooks.info ■CONTENTS viii Getting and Setting RadTextBox Values 37 Working with Buttons 38 Using RadNumericTextBox 39 Setting Minimum and Maximum Values 39 Setting the Type of Numeric Values 40 Using RadDateInput 40 Formatting Dates 41 Validating Dates 43 Parsing Dates 44 Using RadMaskedTextBox 45 Setting the RadMaskedTextBox Mask 45 Using RadInputManager 48 Introducing RadEditor 49 Creating a Custom FileBrowser 52 Customizing the Appearance and Tools 52 Localizing RadEditor 55 Checking Spelling 57 Creating Your Own Dictionary 58 Using System Modules 58 Creating Your Own Module 59 Summary 60 ■Chapter 4: Navigation RadControls 61 Using RadMenu and RadToolBar 61 Binding RadMenu to a Datasource 64 Showing Items in Multiple Columns 66 Navigating with RadMenu 66 Using RadMenu Templates 69 Setting RadMenuItem Custom Attributes 70 Creating a Two-State RadToolBarButton 72 Using RadTreeView 73 Performing Simple Navigation 73 Implementing Drag-and-Drop Functionality 74 Supporting Check Boxes 78 Loading Nodes on Demand 80 Modifying Node Text 81 Using Node Templates 84 www.it-ebooks.info [...]... ecosystem and Pro Telerik ASP.NET and Silverlight Controls is a unique offering that will guide to you the modern front of web application user interface development José Rolando Guay Paz offers a holistic tutorial on building real applications with ASP.NET and Telerik controls by taking you beyond the basics of control usage and including coverage on Layouts, Charting, Reporting, AJAX, MVC, and even... applications using Telerik RadControls (and open the projects included in this book) you need the following tools: • All the projects use the following tools • • • For the ASP.NET Webforms project • • • Microsoft Silverlight 4 Tools for Visual Studio 2010 (free download at http://bit.ly /Silverlight4 ToolsForVS2010) Telerik RadControls for Silverlight (download a trial at http://bit.ly/teleriktrialsilverlight)... are very flexible and implement some unique features Who is This Book For This book is aimed at NET developers working with ASP.NET Webforms and MVC and Silverlight who want to take advantage of the prewritten controls that Telerik provides when developing their software No prior knowledge of Telerik controls is required, but a working knowledge of ASP.NET Webforms and MVC as well as Silverlight is assumed... this book a clear and complete explanation of the main features of each control in Telerik s RadControls for ASP.NET AJAX and Telerik RadControls for Silverlight suites of controls, along with sample code on implementing them and also integrating with each other The book covers the whole set of controls for the ASP.NET platform This includes not only the Webforms platform but also ASP.NET MVC through... (download a trial at http://bit.ly/teleriktrialsilverlight) For the Telerik Reporting projects • • Telerik Extensions for ASP.NET MVC (download for free at http://bit.ly/teleriktrialaspnetmvc) For the Silverlight project • • Telerik RadControls for ASP.NET AJAX (download a trial at http://bit.ly/teleriktrialaspnetajax) For the ASP.NET MVC project • • Visual Studio 2010 (any edition) Microsof SQL Server... ■ INTRODUCING ASP.NET AND TELERIK which has an extension associated with the programming language, it could be CS for C# or VB for VB.NET Whenever ASP.NET processes a page it passes through several stages and different events are raised to handle the processing of the page and its controls You write code to handle these events and thus respond to various actions related to the processing of a page For... environments (staging, production, quality, etc.) Figure 1-4 The Publish Web window 7 www.it-ebooks.info CHAPTER 1 ■ INTRODUCING ASP.NET AND TELERIK ASP.NET MVC ASP.NET MVC is a free and fully supported Microsoft framework for building web applications that use a Model View Controller (MVC) pattern Like ASP.NET web forms, ASP.NET MVC is built on the ASP.NET Framework ASP.NET MVC provides the following... developers Companies like Telerik understand that this complexity exists and their products are designed to help these developers in creating software that delivers high performance, are great from the usability point of view and increase the developer’s productivity Telerik is the first company to provide native Silverlight controls which make them the leaders in the area The controls not only look good... INTRODUCING ASP.NET AND TELERIK Table 1-1 Continued SaveStateComplete Prior to this event the view state for the page and its controls is set Any changes to the page’s controls at this point or beyond are ignored This is useful if you need to write processing that requires the view state to be set Render This is a method of the page object and its controls (and not an event) At this point, ASP.NET calls... ASP.NET MVC through the use of the Telerik Extensions for ASP.NET MVC It also covers the Silverlight suite of controls which targets Silverlight 3 and 4 This book also includes Telerik Reporting to help you build from simple to complex reports; additionaly the book includes a full chapter about Telerik Open Access, the ORM product for all data access Why Telerik RadControls? Over the course of the last . Guay Paz Telerik ASP. NET and Silverlight Controls THE EXPERT’S VOICE ® IN .NET Pro Telerik ASP. NET and Silverlight Controls Master Telerik Controls. version Pro www.it-ebooks.info www.it-ebooks.info Pro Telerik ASP. NET and Silverlight Controls Master Telerik Controls for Advanced ASP. NET and Silverlight