You are previewing Professional DevExpress™ ASP.NET Controls.
O'Reilly logo
Professional DevExpress™ ASP.NET Controls

Book Description

Learn to use Devexpress ASP.NET controls, and get $250 worth of controls included with the book

Devexpress is a leading supplier of ASP.NET controls - the addins used in ASP.NET sites. Not only does this book show you how to make the most of them with Silverlight and Ajax, reporting, calendars, editors, and charts, but you also get actual controls worth $250 on the CD-ROM included with the book.

Regardless of your level of ASP.NET expertise, this complete reference will show you how to implement many award-winning and useful controls into your ASP.NET applications. Controls save time and effort as well as adding functionality, and this book helps you take full advantage of what they offer.

  • Devexpress is a leading vendor for ASP.NET controls that developers can use to add features, accomplish difficult tasks, and save development and testing time

  • This book addresses the all-important use of controls for Silverlight and Ajax, as well as classic essentials like reporting, editors, calendars, and charts

  • Covered controls include reports and charts, HTML editors, menus and treeviews, gridview, and many more

  • Explains when and where to use controls and how to add functionality without additional development

  • CD-ROM includes $250 worth of Devexpress controls ready for you to use right away

With Professional DevExpress ASP.NET Controls, you'll be a step ahead in developing powerful ASP.NET applications.

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

Table of Contents

  1. Copyright
  2. About the Authors
  3. Credits
  4. Acknowledgments
  5. Introduction
  6. I. Grids, Editors, Navigation, and Controls
    1. 1. Programming with the ASPxGridView
      1. 1.1. Understanding How Ajax Delivers Real Performance to the ASPxGridView
        1. 1.1.1. What Does Ajax Do for Web Developers?
        2. 1.1.2. ASPxGridView and Ajax
      2. 1.2. Binding and Editing Data in the ASPxGridView
        1. 1.2.1. Creating a New Data Source from the Task Menu
        2. 1.2.2. Editing Column Information
      3. 1.3. Filtering Data
        1. 1.3.1. Using the Filter Row
        2. 1.3.2. Using the Filter Row Menu
        3. 1.3.3. Filtering with the Header Filter Button
        4. 1.3.4. Defining Dynamic Predicates with the Filter Bar
          1. 1.3.4.1. Filtering with a Logical Or
          2. 1.3.4.2. Adding Condition Groups
        5. 1.3.5. Filtering the Grid Programmatically
        6. 1.3.6. Configuring Filtering Using web.config Settings
      4. 1.4. Grouping and Sorting Data
      5. 1.5. Creating and Using Summary Values
        1. 1.5.1. Calculating Summary Values
        2. 1.5.2. Calculating Custom Summaries
        3. 1.5.3. Calculating Total Custom Summaries
      6. 1.6. Managing the Grid's Appearance
      7. 1.7. Summary
    2. 2. Advanced ASPxGridView Computing
      1. 2.1. Storing Changes
        1. 2.1.1. Implementing Write Behaviors Declaratively
        2. 2.1.2. Using Stored Procedures for Declarative Writes
        3. 2.1.3. Implementing Write Behaviors Dynamically (with Code)
      2. 2.2. Enabling Callback Compression
      3. 2.3. Catching Callback Errors Using an ASPxHttpHandlerModule
        1. 2.3.1. Displaying Callback Errors
        2. 2.3.2. Redirecting Callback Errors to a Specific Web Error Page
          1. 2.3.2.1. Logging Errors in Application_Error Event
          2. 2.3.2.2. Implementing an Error Logging IHttpModule
      4. 2.4. Binding the ASPxGridView to an ArrayList or Collection
        1. 2.4.1. Binding an ArrayList to an ASPxGridView
        2. 2.4.2. Binding a Generic Collection to an ASPxGridView
          1. 2.4.2.1. Defining Custom Entities and Collections
          2. 2.4.2.2. Initializing Custom Collections
          3. 2.4.2.3. Using Test Projects
            1. 2.4.2.3.1. Implementing an Object Dumper Using Reflection
            2. 2.4.2.3.2. For Fun: Implementing an Object Dumper with LINQ
          4. 2.4.2.4. Binding a Custom Collection to an ASPxGridView
      5. 2.5. Using Unbound Columns
      6. 2.6. Implementing a Custom Sort
      7. 2.7. Exporting Grid Data
        1. 2.7.1. Exporting ASPxGridView Data to PDF, RTF, CSV, and XLS
        2. 2.7.2. Adding Export Detail with the RenderBrick Event
        3. 2.7.3. Implementing Your Own Exporter
      8. 2.8. Using Master and Detail Grids
      9. 2.9. Saving User Customizations with Cookies
      10. 2.10. Programming Client-Side Events
        1. 2.10.1. Adding an ASPxPopupMenu to an ASPxGridView
        2. 2.10.2. Implementing the ASPxPopupMenu Behavior
        3. 2.10.3. Debugging JavaScript
      11. 2.11. Using Custom Script Properties
      12. 2.12. Enabling Horizontal Scrolling
      13. 2.13. Displaying Images Directly from a Database in a Template Region
        1. 2.13.1. Displaying Images from a Database Manually
        2. 2.13.2. Displaying Images from a Database in the ASPxGridView
      14. 2.14. Summary
    3. 3. Using the ASPxTreeList, ASPxDataView, and ASPxNewsControl
      1. 3.1. Displaying Data in Tree Views
        1. 3.1.1. Using the ASPxTreeList in Unbound Mode
          1. 3.1.1.1. Defining Columns
          2. 3.1.1.2. Adding TreeListNodes Programmatically
            1. 3.1.1.2.1. Tightening Up the Code with Refactor! Pro
            2. 3.1.1.2.2. Replacing foreach with Array.ForEach
          3. 3.1.1.3. Defining Template Columns
        2. 3.1.2. Creating a Windows Explorer-Style Web Page with Virtual Mode
        3. 3.1.3. Binding (over Building) to a SqlDataSource
          1. 3.1.3.1. Defining a Query with the Query Builder
          2. 3.1.3.2. Paging (and Overlapping Control Features)
        4. 3.1.4. Sorting Hierarchies of Data
        5. 3.1.5. Modifying ASPxTreeList Data
          1. 3.1.5.1. Editing When a Node Contains Multiple Tables
            1. 3.1.5.1.1. Implementing an UPDATE Stored Procedure with T-SQL
            2. 3.1.5.1.2. Constructing the Web Page with an Updatable ASPxTreeList
          2. 3.1.5.2. Defining a Custom Form Template
            1. 3.1.5.2.1. Adding the Update and Cancel Command Controls to the Toolbox
            2. 3.1.5.2.2. Constructing a Custom Edit Template
          3. 3.1.5.3. Editing ASPxTreeList Data Programmatically
        6. 3.1.6. Exporting Data from an ASPxTreeList
      2. 3.2. Introducing the ASPxDataView
      3. 3.3. Displaying News and Product Headlines in a Web Page
        1. 3.3.1. Using the ASPxNewsControl to Display Information about Published Books
        2. 3.3.2. Reading ASPxNewsControl Images from a Database
          1. 3.3.2.1. Using an IHttpHandler to Read Images from the Database
            1. 3.3.2.1.1. Replacing an Image URL Field with an IHttpHandler Request
            2. 3.3.2.1.2. Querying the Image and Writing It to the HttpResponse Stream
          2. 3.3.2.2. Optimizing Database Reads with the Application Cache
      4. 3.4. Summary
    4. 4. Adding SiteMaps, Navigation, and Pop-Up Dialog Boxes
      1. 4.1. Implementing a Navigation Bar
        1. 4.1.1. Incorporating Basic Navigation Using an XML File
          1. 4.1.1.1. Authoring an XML File
          2. 4.1.1.2. Creating an XML File Using Functional Construction and LINQ
          3. 4.1.1.3. Binding the XML Data to an ASPxNavBar
          4. 4.1.1.4. Configuring the ASPxNavBar
        2. 4.1.2. Exploring the Boundaries of the ASPxNavBar
          1. 4.1.2.1. Adding Groups to an ASPxNavBar
          2. 4.1.2.2. Defining Templates and Nesting Controls in the ASPxNavBar
            1. 4.1.2.2.1. Adding Group Items
            2. 4.1.2.2.2. Defining Custom JSProperties
            3. 4.1.2.2.3. Getting User Information with JavaScript
            4. 4.1.2.2.4. Defining an ItemTextTemplate
            5. 4.1.2.2.5. Nesting Controls in a ContentTemplate
          3. 4.1.2.3. Updating Dependent Controls Asynchronously with the CustomCallback
            1. 4.1.2.3.1. Making JavaScript Easier with the ClientInstanceName
            2. 4.1.2.3.2. Programming ClientSideEvents to Initiate a CustomCallback
          4. 4.1.2.4. Enabling animation
          5. 4.1.2.5. Improving the appearance with a theme
      2. 4.2. Facilitating Social Networking with the ASPxCloudControl
        1. 4.2.1. Configuring Microsoft Indexing Service
        2. 4.2.2. Defining a Catalog and Directory, and Building the Index
        3. 4.2.3. Linking the Indexing Service to the FileSystem Via SQL Server
        4. 4.2.4. Querying the Indexing Service
        5. 4.2.5. Configuring the ASPxCloudControl
          1. 4.2.5.1. Setting the ASPxCloudControl properties
          2. 4.2.5.2. Examining the Supporting C# code
      3. 4.3. Creating a Sitemap with XML and the ASPxSiteMapControl
        1. 4.3.1. Binding an ASPxSiteMapControl to an Existing .sitemap File
        2. 4.3.2. Building a Sitemap Based on the Current Structure of Your Site
        3. 4.3.3. Building a Site Map Dynamically
      4. 4.4. Using Modal Dialogs in ASP.NET
        1. 4.4.1. Blending showModalDialog with JavaScript and the ASPxCallbackPanel
          1. 4.4.1.1. Using a RequiredFieldValidator
          2. 4.4.1.2. Implementing the OK Behavior
          3. 4.4.1.3. Implementing the Cancel Behavior
          4. 4.4.1.4. Displaying a Modal Dialog with showModalDialogs
          5. 4.4.1.5. Sending User Input to the Server Using the ASPxCallbackPanel
        2. 4.4.2. Implementing a Modal Login Window with the ASPxPopupControl
          1. 4.4.2.1. Replacing the RequiredFieldValidators with ASPxTextBox ValidationSettings
            1. 4.4.2.1.1. Defining a ValidationGroup
            2. 4.4.2.1.2. Specifying a Required Field
          2. 4.4.2.2. Coding the Client-Side Events for the Popup
            1. 4.4.2.2.1. Using the ASPxClientEdit Object
      5. 4.5. Summary
    5. 5. Implementing a Menu and Tabbed Controls
      1. 5.1. Building Menus with the ASPxMenu
        1. 5.1.1. Defining Menu Items
        2. 5.1.2. Binding to an ASPxSiteMapDataSource and XML File
        3. 5.1.3. Exploring ASPxMenu Features
          1. 5.1.3.1. Defining Menu Separators
          2. 5.1.3.2. Adding Menu Tooltips
          3. 5.1.3.3. Specifying Display Delay
          4. 5.1.3.4. Using MenuItem Hot Tracking and Opacity
        4. 5.1.4. Defining Menu Items with Code
        5. 5.1.5. Defining Menu Templates
          1. 5.1.5.1. Using the ASPxRoundPanel
          2. 5.1.5.2. Adding a CallbackPanel
          3. 5.1.5.3. Defining the ClientInstanceName or Not
          4. 5.1.5.4. Adjusting the ASPxMenu's Gutter Width
          5. 5.1.5.5. Adding Separators between Groups of MenuItems
          6. 5.1.5.6. Using an HTML<table> to Manage Template Layout
            1. 5.1.5.6.1. Converting a Number to a String in JavaScript
            2. 5.1.5.6.2. Converting a String to a Number
            3. 5.1.5.6.3. Closing All Menus with JavaScript
            4. 5.1.5.6.4. Converting Strings to Enum Types
            5. 5.1.5.6.5. Creating Templates Quickly
        6. 5.1.6. Implementing a Tabbed Menu
          1. 5.1.6.1. Defining the RootItemTemplate
          2. 5.1.6.2. Enhancing Visual Appearance with a Cascading Style Sheet
            1. 5.1.6.2.1. Using a Background Image to Create a Gradient Effect
            2. 5.1.6.2.2. Using Images to Shape the ASPxMenu's Appearance
            3. 5.1.6.2.3. Creating a Gradient Effect with a DXImageTransform
        7. 5.1.7. Emulating a Toolbar with the ASPxMenu
      2. 5.2. Incorporating Pop-Up Menus into Your Web Application
        1. 5.2.1. Designing the ASPxPopupMenu
        2. 5.2.2. Implementing the JavaScript Class
        3. 5.2.3. Coding the Client-Side Behaviors
      3. 5.3. Creating Tabbed Views
        1. 5.3.1. Customizing the Appearance of Tabs
        2. 5.3.2. Using the ASPxPageControl
      4. 5.4. Summary
    6. 6. Managing Scheduled Items and Using Gauges
      1. 6.1. Scheduling Calendar Events
        1. 6.1.1. Data Binding an AccessDataSource to the ASPxScheduler
          1. 6.1.1.1. Reviewing the CarsDB.mdb Database Tables
          2. 6.1.1.2. Mapping the CarsDB.mdb Tables to the ASPxScheduler
            1. 6.1.1.2.1. Mapping the Appointments Data Source
            2. 6.1.1.2.2. Mapping the Resources Data Source
          3. 6.1.1.3. Implementing the Code-Behind to Support Inserts
        2. 6.1.2. Using the Scheduler in List Bound Mode
          1. 6.1.2.1. Defining the Custom Entity Class
          2. 6.1.2.2. Implementing the BindingList<T> class
          3. 6.1.2.3. Implementing the Custom Data Source
          4. 6.1.2.4. Defining and Associating the Custom Data Source with an ObjectDataSource
          5. 6.1.2.5. Programmatically Defining the Appointment Mappings
          6. 6.1.2.6. Programmatically Specifying the Resources
          7. 6.1.2.7. Completing the Code-Behind
        3. 6.1.3. Exploring View Types
          1. 6.1.3.1. Changing Work Days
          2. 6.1.3.2. Modifying the Holidays Collection
            1. 6.1.3.2.1. Using the ASPxDateNavigator
            2. 6.1.3.2.2. Displaying Multiple Months
        4. 6.1.4. Changing the Active View with Client-Side Script
        5. 6.1.5. Grouping Schedule Events with the ASPxResourceNavigator
        6. 6.1.6. Defining an Appointment Template
          1. 6.1.6.1. Implementing the UserControl Template
          2. 6.1.6.2. Incorporating the Template in the ASPxScheduler's DayView
        7. 6.1.7. Exporting and Importing a Calendar
      2. 6.2. Using the ASPxGaugeControl
        1. 6.2.1. Exploring the ASPxGaugeControl Properties
        2. 6.2.2. Dynamically Applying Gauge Styles
          1. 6.2.2.1. Assembling the Sample GUI
          2. 6.2.2.2. Implementing the Code-Behind
            1. 6.2.2.2.1. Exploring the Page_Load and Callback Handlers
            2. 6.2.2.2.2. Reviewing the MatchCollection in the CallbackParameterParser
            3. 6.2.2.2.3. Exploring the StyleChangedHandler
        3. 6.2.3. Data Binding Gauges
          1. 6.2.3.1. Adding Labels
          2. 6.2.3.2. Adding Gauge Needles
            1. 6.2.3.2.1. Associating Needles with ArcScaleNeedleComponents
            2. 6.2.3.2.2. Specifying (Needle) Shaders
          3. 6.2.3.3. Adding DataBinding to the ArcScaleComponent
          4. 6.2.3.4. Defining the Custom Data Type
          5. 6.2.3.5. Implementing Custom Extension Methods
          6. 6.2.3.6. Reading the XML Data with LINQ for XML
          7. 6.2.3.7. Dynamically Updating the Scale
      3. 6.3. Summary
  7. II. Data Sources, JavaScript, CSS, and Themes
    1. 7. Using the Data That Makes Sense for Your Solution
      1. 7.1. Using an XpoDataSource
        1. 7.1.1. Using the DevExpress' Object Relational Mapping Capability
        2. 7.1.2. Using the ASPxTitleIndex with an XpoDataSource
        3. 7.1.3. Using a View with (XPO) Persistent Objects
          1. 7.1.3.1. Defining a Persistent Class Based on a View
          2. 7.1.3.2. Specifying XpoDataSource Criteria
          3. 7.1.3.3. Contriving a Unique ID for Views
      2. 7.2. Enabling ServerMode for High Performance Applications
      3. 7.3. Generating a Database Dynamically with XPO
        1. 7.3.1. Requesting a Connection String from the Database Server
        2. 7.3.2. Defining the Tweet Class
        3. 7.3.3. Creating a Database Dynamically with XPO
        4. 7.3.4. Querying Twitter
        5. 7.3.5. Extracting the Tweet Data with LINQ for XML
        6. 7.3.6. Using UnitOfWork to Update the Database
      4. 7.4. Summary
    2. 8. Implementing Data Solutions with the ASPxPivotGrid
      1. 8.1. Transforming Relational Data into an ASPxPivotGrid
        1. 8.1.1. Using Relational Data in an ASPxPivotGrid
          1. 8.1.1.1. Defining the SQL Query
          2. 8.1.1.2. Configuring the ASPxPivotGrid Fields
        2. 8.1.2. Using Multiple Data Fields
        3. 8.1.3. Choosing the Field Summary Type
        4. 8.1.4. Implementing a Custom Summary
        5. 8.1.5. Calculating Fields Manually
        6. 8.1.6. Using the Built-in Summary Variation Feature
      2. 8.2. Exporting Data to Create Crosstab Reports
      3. 8.3. Binding to an OLAP Cube
      4. 8.4. Using an ASPxPivotGrid as a WebChartControl's Data Source
      5. 8.5. Grouping Axis Values
        1. 8.5.1. Grouping Axis Values
        2. 8.5.2. Grouping Values Manually
      6. 8.6. Arranging Values Hierarchically
        1. 8.6.1. Creating a Hierarchy
        2. 8.6.2. Keeping Fields Together
      7. 8.7. Calculating Totals
        1. 8.7.1. Computing Summaries Automatically
        2. 8.7.2. Computing Running Totals
        3. 8.7.3. Using Manually Specified Totals
      8. 8.8. End-User Data Filtering
      9. 8.9. Sorting Data and Displaying Top or Bottom Values
        1. 8.9.1. Sorting Manually
        2. 8.9.2. Displaying Top or Bottom Numbers
      10. 8.10. Using the Drill-Down Window
      11. 8.11. Summary
    3. 9. Using the ASPxHtmlEditor
      1. 9.1. Managing ASPxHtmlEditor Features
        1. 9.1.1. Enabling or Disabling Scripts
        2. 9.1.2. Allowing IFrames
        3. 9.1.3. Allowing Form Elements
        4. 9.1.4. Allowing Supported Editor Views
        5. 9.1.5. Updating Document Elements Automatically
      2. 9.2. Defining a Custom ASPxHtmlEditor Toolbar
        1. 9.2.1. Adding a Custom Toolbar Item with Code
        2. 9.2.2. Defining CustomCommand Toolbar Behavior and Ajax
      3. 9.3. Applying Custom Styles (CSS)
      4. 9.4. Enabling Spell Checking
      5. 9.5. Summary
    4. 10. Using Themes, CSS, and JavaScript for Customizations and Enhancements
      1. 10.1. Defining and Managing Style Information
        1. 10.1.1. Specifying Style Information and Understanding Precedence
          1. 10.1.1.1. Creating Inline Styles
          2. 10.1.1.2. Creating Page-Specific Styles
          3. 10.1.1.3. Linking External Cascading Style Sheets
          4. 10.1.1.4. Understanding Style Precedence
        2. 10.1.2. Creating Cascading Style Sheets
          1. 10.1.2.1. Defining Element-based Styles
          2. 10.1.2.2. Defining Class-based styles
          3. 10.1.2.3. Defining ID-based Styles
          4. 10.1.2.4. Defining At-rule Styles
          5. 10.1.2.5. Qualifying Style Rules with Specific Selectors
          6. 10.1.2.6. Exploring Additional Style Sheet Attributes
            1. 10.1.2.6.1. Using the Expression Attribute
            2. 10.1.2.6.2. Using the Behavior Attribute
            3. 10.1.2.6.3. Using the !Important Declaration
            4. 10.1.2.6.4. Defining Filters
            5. 10.1.2.6.5. Specifying an Accelerator
            6. 10.1.2.6.6. Using the Zoom Attribute
          7. 10.1.2.7. Creating a Behavior Script Component
        3. 10.1.3. Managing Style Information with Visual Studio Features
      2. 10.2. Using Skins and Themes
        1. 10.2.1. Applying Existing Themes
        2. 10.2.2. Applying a Theme to Your Web Application
        3. 10.2.3. Changing a Theme Dynamically
        4. 10.2.4. Defining Custom Skins and Themes
          1. 10.2.4.1. Creating a New Skin File
          2. 10.2.4.2. Defining a Custom Theme
      3. 10.3. Making the Most of JavaScript
        1. 10.3.1. Common Client-Side Functionality
        2. 10.3.2. Client-Side Discussion
        3. 10.3.3. Client-Side Events
          1. 10.3.3.1. Quick Language Overview
          2. 10.3.3.2. Creating a Singleton
          3. 10.3.3.3. Prototypal Inheritance
        4. 10.3.4. JavaScript Debugging
      4. 10.4. Summary
  8. III. Ajax, Charting, Reporting, and Cloud Computing
    1. 11. Asynchronous Computing for ASP.NET
      1. 11.1. Controlling Asynchronous Behavior with a Timer
        1. 11.1.1. Controlling Asynchronous Behavior with Callbacks
        2. 11.1.2. Using the ASPxCallback Control
        3. 11.1.3. Using the ASPxCallbackPanel Control
      2. 11.2. Displaying Multimedia Content
        1. 11.2.1. Creating a YouTube Player
        2. 11.2.2. Controlling the YouTube Player
        3. 11.2.3. Playing FLV Files
      3. 11.3. Summary
    2. 12. Adding Charts and Graphs to Your Applications
      1. 12.1. The Vernacular
      2. 12.2. Creating a Chart
      3. 12.3. Medium Trust
      4. 12.4. Real-time Updates
      5. 12.5. Runtime Visual Effects
      6. 12.6. Summary
    3. 13. XtraReports For the Web
      1. 13.1. Creating a Tabular Report
        1. 13.1.1. Displaying the Report in an ASP.NET Web Page
      2. 13.2. Using the SQLDataAdapter as a DataSource
      3. 13.3. Using an IBindingList as a DataSource
      4. 13.4. Using XML as a DataSource
      5. 13.5. Conditional Report Bands
      6. 13.6. Master-Detail Report
      7. 13.7. Drill-Through Report
      8. 13.8. Label Report
      9. 13.9. Mail Merge Report
      10. 13.10. Caching the Report
      11. 13.11. Parameterized Stored Procedure Report
      12. 13.12. Combining Multiple Reports
      13. 13.13. End-User Report Designer
      14. 13.14. Summary
    4. A. Understanding How Web Applications Differ from Windows Applications
      1. A.1. Using ASP.NET Page Lifecycle Events
        1. A.1.1. Mastering Events
        2. A.1.2. Reviewing the ASP.NET Lifecycle
        3. A.1.3. Upgrading to IIS 7
        4. A.1.4. Reviewing Lifecycle Events
        5. A.1.5. Programming Application-Level Events
          1. A.1.5.1. Writing to the EventLog
            1. A.1.5.1.1. Creating an Installer
            2. A.1.5.1.2. Running the Installer
            3. A.1.5.1.3. Writing to the EventLog from a Web Application
            4. A.1.5.1.4. Viewing the Event Entry in Visual Studio
        6. A.1.6. Programming Page-Level Events
      2. A.2. Understanding ViewState
      3. A.3. Why Session Information Is So Important
        1. A.3.1. Understanding Session Servers
          1. A.3.1.1. Configuring the SQL Server Session State Database
      4. A.4. Leaving ViewState on the Server with PageAdapters
      5. A.5. Caching Controls, Pages, and Data
        1. A.5.1. Using the @OutputCache Directive
        2. A.5.2. Caching Multiple Page Versions
        3. A.5.3. Caching Parts of a Page
        4. A.5.4. Caching Application Data
          1. A.5.4.1. Adding Data to and Removing Data from the Application Cache
          2. A.5.4.2. Using Cache Dependencies to Refresh Data
          3. A.5.4.3. Expressing an Expiration Policy
          4. A.5.4.4. Receiving Notification of Items Removed from the Cache
      6. A.6. Summary