Upload
tranque
View
230
Download
4
Embed Size (px)
Citation preview
Pro TelerikASP.NET
and SilverlightControls
Master Telerik Controls for AdvancedASP.NET and Silverlight Projects
II ill i!
Jose Rolando Guay Paz
Anress*
HForeword xviii
About the Author xix
HAbout 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
f Chapter 3: Input RadControls 33
Introducing Radlnput 33
Understanding Common Properties and Events 33
Using RadTextBox 36
vii
CONTENTS
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 RadDatelnput 40
Formatting Dates 41
Validating Dates 43
Parsing Dates 44
Using RadMaskedTextBox 45
Setting the RadMaskedTextBox Mask 45
Using RadlnputManager 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 RadMenultem 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
viii
CONTENTS
Using RadSiteMap 85
Working with the Layout 85
Working with Templates 88
Binding RadSiteMap to a Datasource 89
Using RadPanelBar 91
Navigating with RadPanelBar 91
Binding to a Database 91
Creating an Automatic Hierarchy 93
Defining Templates 94
Summary 96
iiChapter 5: Date, Time, and Scheduling RadControls,
97
Using the RadCalendar Control 97
Choosing a Month View 97
Adding Special Dates and Day Templates 99
Configuring Localization and Globalization 100
Controlling the Appearance of the Day with the DayRender Event 101
Setting the RadDatePicker Allowed Date Rage 102
Using RadDatePicker Shared Calendars 103
Intercepting the Selected Date 104
Using RadTimePickerand RadDateTimePicker 105
Creating Custom Hours Collection 105
Using RadScheduler 106
Declarative Data Binding to a Database 107
Storing Appointments 107
Data Binding to a Web Service 110
Implementing the Data Provider 110
Localizing and Globalizing 117
Adding Context Menus 120
Working with Templates 123
Exporting to iCal Format 124
Using Resources 126
Summary 129
Chapter 6: Data RadControls, Part 1 131
RadComboBox 131
Binding RadComboBox 132
Implementing Client Operations 133
ix
CONTENTS
Accessing Client Changes in the Code Behind 135
Loading Items on Demand 137
Implementing RadComboBox Caching 141
Using ShowMoreResultsBox and EnableVirtualScrolling Properties 144
Implementing Automatic Loading On Demand 146
Creating Item Templates 147
RadGrid 149
Understanding the Structure of RadGrid 150
Understanding the Types of Grids 150
Working with RadGrid Columns 150
Working with RadGrid Rows 154
Accessing Rows and Cells 155
Making Use of the Design Time Support 156
Implementing Simple DataBinding 157
Implementing Declarative Data Binding 159
Implementing Advanced DataBinding 160
Understanding the RadGrid Event Life Cycle 161
Binding RadGrid on the Client Side 164
Implementing RadGrid Data Manipulation Operations 174
Sorting 174
Paging 177
Scrolling 181
Grouping 185
Filtering 193
Inserting, Updating, and Deleting Records 196
Implementing Client-Side API 213
Summary 227
Chapter 7: Data RadControls, Part 2 229
RadFilter 229
RadListView 234
Implementing Data Binding for RadListView 234
Handling RadListView Editing Operations 240
Working with RadListView Templates 251
Selecting Items in RadListView 258
Implementing Paging in RadListView 259
Grouping in RadListView 265
Implementing Filtering and Sorting in RadListView 266
X
SSCONTENTS
RadLlstBox 273
Implementing Data Binding for RadListBox 273
Reordering Items in RadListBox 274
Transferring Items Between RadListBoxes 275
Adding Images and Check Boxes to RadListBox Items 276
Working with RadListBox Item Templates 277
Summary 279
Chapter 8: Layout RadControls 281
Using RadTabStrip and RadMultiPage 281
Creating a Hierarchical RadTabStrip 282
Binding to a Database 283
Working with Templates and Scrolling 284
Combining RadTabStrip and RadMultiPage 286
Using RadWindow and RadWindowManager 289
Creating and Opening RadWindows 290
Adding RadWindow Behaviors 291
Creating a Modal RadWindow 292
Communicating Between RadWindows 293
Implementing MDI and Minimized Zones 299
Replacements for Browser Dialogs 301
Using RadSplitter 303
Dividing Page Content with RadSplitter 303
Implementing Collapsible Panes 304
Resizing to Fill a Window 306
Creating Sliding Panes 308
Using RadDock 312
Creating a Working Dock Layout 312
Writing Custom Commands 314
Dynamically Creating RadDocks 315
Using RadRotator 320
Using Data Binding, Templates, and Rotations 320
Working with RadTicker 324
Combining RadRotator and RadTicker 325
Summary 327
CONTENTS
Chapter 9: Chart and Image RadControls 329
RadChart 329
RadChart Structure 329
Examining Chart Types 330
Bar Charts 330
Line Chart 330
Pie Charts 331
Area Charts 331
Gantt Charts 332
Point and Bubble Charts 332
Bezier Charts 333
Candlestick Charts 333
Zooming and Scrolling 340
Creating Marked Zones 343
Adding Scale Breaks 347
Plotting Negative Values 350
Using Multiple Series Types in One Chart and Data Table 353
Working with Image Maps 356
Creating Drill-Down Charts 361
RadBinarylmage 364
Using RadBinarylmage in ASP.NET Repeater 365
Using RadBinarylmage in RadGrid 366
RadRating 368
Using RadRating to Collect Feedback 369
Using RadRating in RadGrid 373
RadColorPicker 375
Building a Custom Palette 378
Summary 380
Chapter 10: Additional RadControls 381
RadFormDecorator 381
Decorating Controls 381
Using the DecoratedZonelD Property 382
RadCaptcha 383
Implementing RadCaptcha Image Mode 384
Implementing RadCaptcha's Invisible Text Box Mode 387
Implementing RadCaptcha Minimum Submission Time 388
xii
I«CONTENTS
RadToolTip 388
Implementing RadToolTipManager's AutoTooltipify and ToolTipZonelD 392
Loading RadToolTip Information on Demand 395
Loading RadToolTip on Demand from a Web Service 400
RadUpload 404
Implementing RadUpload 405
Filtering Uploaded Files with AllowedFileExtensions 406
Implementing Asynchronous Uploads 406
Monitoring the Upload Progress 408
Using RadProgressArea to Monitor Custom Processes 409
RadFileExplorer 411
RadSlider 412
Implementing RadSlider Items 414
Using the RadSlider Client-Side API 414
Summary 419
Chapter 11: RadAjax 421
RadAjaxManager and RadAjaxManagerProxy 421
Implementing Client-Side Events 424
Working with the Client-Side API 428
Implementing RadAjaxManager in Web User Controls and Master Pages 429
RadAjaxPanel 431
Working with RadAjaxPanel 431
Forcing an AJAX Update 433
RadAjaxLoadingPanel 435
Configuring RadAjaxLoadingPanel Properties 436
Implementing Explicit Show/Hide 438
RadCodeBlock and RadScriptBlock 439
RadXmlHttpPanel 440
Implementing RadXmlHttpPanel with Callback 441
Implementing RadXmlHttpPanel with WebService 444
Summary 447
xiii
CONTENTS
Chapter 12: Telerik Extensions for ASP.NET MVC 449
Quick Recap on Configuration 449
Calendar 450
Defining the Date Range 451
Implementing a Select Action 451
Implementing Globalization 453
Working with Calendar's Client API 455
Date Picker 457
Implementing Date Ranges and the ShowButton Property 457
Parsing Dates 458
Implementing Globalization 459
Working with DatePicker's Client API 461
NumericTextBox 463
Implementing Value Range and Spin Buttons 463
Validating User Input with Server Validation 464
Validating User Input with Model-Based Validation 466
Implementing Globalization 467
Working with NumericTextBox's Client API 468
Menu 470
Creating a Menu Declarative and Defining the Menu Orientation 470
Binding to an Object Model 472
Creating Menu Templates 473
Working with Menu's Client API 475
PanelBar 478
Binding to an Object Model 480
Creating Templates 481
Loading Content on Demand 483
Working with PanelBar's Client API 485
TabStrip , 488
Creating a TabStrip Declaratively 488
Binding TabStrip to an Object Model 489
Creating TabStripltem's Content 490
Loading Content on Demand 492
Working with TabStrip's Client API 493
TreeView 496
Creating a TreeView Declaratively and Enabling Check Boxes 496
Working with Drag-and-Drop 498
xiv
ICONTENTS
Binding TreeView to an Object Model 501
Creating Templates 502
Loading Content on Demand 503
Working with the Client API 505
Grid 508
Implementing Grid Operations 508
Binding to Data 510
Editing Operations 514
Implementing Templates 523
Working with Grid's Client API 525
Summary 529
iChapter 13: RadControls for Silverlight 531
Configuring Telerik RadControls for Silverlight 531
Enhancing the Navigation 535
Adding the Product Catalog 539
Improving the Home Page with a Dashboard 542
Implementing RadTileView 543
Implementing RadTileViewltem 549
Implementing RadChart 551
Implementing RadGridView 555
Implementing RadGauge 557
Creating the Categories Page 560
Creating the Employees Page 567
Implementing RadDocking 567
Adding the Regions and Territories 570
Implementing RadMap 576
More Interesting Controls 579
RadScheduler 579
RadCoverFlow 580
RadMediaPlayer 581
RadRibbonBar 581
RadUpload 582
RadDragAndDropManager 583
Summary 584
XV
CONTENTS
Chapter 14: Introducing Telerik Reporting 585
Installing and Configuring Telerik Reporting 585
Configuring Your Application 585
Knowing the Players 587
Reports 587
Viewers 590
Designers 591
Report Designer 591
Report Explorer 592
Data Explorer 593
Group Explorer 593
Report Wizard 593
Loading Data 594
Using the Datasource Components in the Report Designer 594
Using Expressions and the Expression Dialog 595
Using the Datasource Components Programmatically 596
Data Binding 596
Adding Calculated Fields 596
Filtering with Report Parameters 597
Grouping and Sorting Data 598
Creating Reports 600
Using the Report Wizard 600
Sorting 602
Filtering 603
Creating a Crosstab Report 604
Grouping 606
Formatting 607
Using Subreports 608
Displaying Reports in the Application 612
Using the Web Report Viewer 612
Using the Silveriight Report Viewer 614
Configuring the Web Application 614
Configuring the Silveriight Application 616
Using the ReportBook Control 618
Adding a Document Map 620
Summary 620
xvi
eContents
Chapter 15: Telerik OpenAccess ORM 621
System Requirements 621
Installing Telerik OpenAccess ORM 622
Configuring Your Application 623
Deploying Your Application 624
Creating the Data Model 625
Using the Enable Project Wizard 626
Adding the Mapping Classes 631
Using Reverse Mapping (Tables to Classes) 631
Forward Mapping 636
Using the Visual Domain Model Designer 637
Querying the Data Model 640
Using LINQ 640
Using OQL 641
Using SQL Statements 641
Executing Stored Procedures 641
Working Within Transactions 643
Setting the Transaction Scope 643
Adding, Updating, and Deleting Objects 644
Using Fetch Plans and Fetch Groups 645
Implementing Inheritance 653
Flat Mapping 654
Vertical Mapping 656
Mixed Mapping 657
Horizontal Mapping 658
Summary 658
Index 661
xvii