35
807 INDEX Symbols ~ Syntax, 256 A absolute expiration date, 598 absolute URLs, 254, 256–257 abstract classes, 199 access, user authorization rules, 605 blocked to Management folder, 632 and identity authentication, 604 and rule satisfaction, 635 access modifiers, 178, 200 AccessKey property, 114 accounts managing with WSAT, 628–632 signup pages, 607–612 active item tracking, 406 Active Server Pages (ASP), 1 ActiveStepIndex, 129 Add New Item dialog, 210, 228 addClass method, 404 <add> element, 645, 651 Add/Edit pages, 579, 588 AddEditReview.aspx page, 580 ADO.NET Entity Framework for data access, 580 Data Model, 44, 552 defined, 552 introduction to, 500–501 lazy loading, 505 LINQ overlap with, 499 LINQ to, 499–500 mapping data models, 501 practical tips for, 550 use of data controls with, 517 use of LINQ, 497–498 AdRotator control, 131 Advanced SQL Generation Options, 474 advertisers' cookies, 239 <a> element, 254, 281 aggregation operators, 509 Ajax. see also ASP.NET AJAX code in form animation, 412 creating flicker-free pages with, 358–362 defined, 383 Extensions, 134 framework, 351 ScriptManager control, 356–357, 372–373 spelling of, 350 summary of, 382 UpdatePanel control, 352–356 UpdateProgress control, 358 web services, 363–378 AjaxFrameworkMode property, 357 albums, photo inserting new, 524 login controls to manage, 609 photo deletion from, 637 profile of album creator, 673 COPYRIGHTED MATERIAL

INDEX [] file807 INDEX Symbols ~ Syntax, 256 A absolute expiration date, 598 absolute URLs, 254, 256–257 abstract classes, 199 access, user authorization rules, 605

  • Upload
    lamcong

  • View
    220

  • Download
    0

Embed Size (px)

Citation preview

807

INDEX

Symbols

~ Syntax, 256

A

absolute expiration date, 598absolute URLs, 254, 256–257abstract classes, 199access, user

authorization rules, 605blocked to Management folder, 632and identity authentication, 604and rule satisfaction, 635

access modifiers, 178, 200AccessKey property, 114accounts

managing with WSAT, 628–632signup pages, 607–612

active item tracking, 406Active Server Pages (ASP), 1ActiveStepIndex, 129Add New Item dialog, 210, 228addClass method, 404<add> element, 645, 651Add/Edit pages, 579, 588AddEditReview.aspx page, 580ADO.NET Entity Framework

for data access, 580Data Model, 44, 552defined, 552introduction to, 500–501

lazy loading, 505LINQ overlap with, 499LINQ to, 499–500mapping data models, 501practical tips for, 550use of data controls with, 517use of LINQ, 497–498

AdRotator control, 131Advanced SQL Generation Options, 474advertisers' cookies, 239<a> element, 254, 281aggregation operators, 509Ajax. see also ASP.NET AJAX

code in form animation, 412creating flicker-free pages with,

358–362defined, 383Extensions, 134framework, 351ScriptManager control, 356–357,

372–373spelling of, 350summary of, 382UpdatePanel control, 352–356UpdateProgress control, 358web services, 363–378

AjaxFrameworkMode property, 357albums, photo

inserting new, 524login controls to manage, 609photo deletion from, 637profile of album creator, 673

bindex.indd 807bindex.indd 807 10/4/2012 9:56:32 PM10/4/2012 9:56:32 PM

COPYRIG

HTED M

ATERIAL

808

allowAnonymous attribute – ASP.NET Instant Results

user creation of, 518user management of, 665–670viewing photos in, 544

allowAnonymous attribute, 646AllowCustomErrorsRedirect property, 356AlternateText property, 310<AlternatingItemTemplate>, 525AlternatingRowStyle, 556And operator, 164AND operator, 430AndAlso operator, 164animate() effect, 409animation

contact form, 410–414jQuery, 399, 409

anonymous identification, 670–671anonymous profiles, 671–672anonymous types, 511–517, 552ANSI 92 SQL standard, 425App_Code folder, 180, 221App_Data folder, 754AppConfiguration class, 737AppendAllText method, 340Application Mapping, 10Application Pool, 466, 766application services, 642applicationName attribute, 625ApplicationPoolIdentity, 753Apply Styles window, 87, 98, 100args.AnonymousID, 671arithmetic operators, 158ArrayList, 155, 156arrays, 153–154<article> element, 12.ascx extension, 286Combine with next aside element, 84<aside> element, 12ASMX web services, 364<asp:ListItem> elements, 122ASP.NET

App_Code folder, 401application services, 605–607authentication mechanism, 613caching mechanism, 590code compilation, 146control life cycle, 564–569controls to render jQuery, 418database use, 421development, 14.0, 2184.5, 10–11, 112, 517, 606, 750informational windows, 22–23installing/configuring, 748–749markup, 161.0, 1page life cycle, 219–220pre-2.0 user controls, 285previous versions, 2Profile service, 644–645programmatic redirection, 276resources on, 764–765role of server controls in, 107routing support, 2812.0, 605validation controls, 312web page tracing, 718–725website, 765

ASP.NET AJAX, 349–383. see also Ajaxcreating flicker-free pages with, 352–357exercises with, 382Extensions Timer control, 362–363introduction to, 350–351pageLoad, 413practical tips for, 381spelling of, 350summary of, 382web service creation, 369

ASP.NET Dynamic Data Entities Web Sites, 36

ASP.NET Instant Results, 549

bindex.indd 808bindex.indd 808 10/4/2012 9:56:32 PM10/4/2012 9:56:32 PM

809

ASP.NET Server Controls – base pages

ASP.NET Server Controls, 107–144applying CSS to, 103in ASP.NET 4.5, 10common properties of, 113–116creating a web page with, 20defining on a page, 113EnableViewState property, 140exercises with, 142introduction to, 108–112for login page, 611markup, 16on master pages, 212practical tips for, 141–142state engine, 134–141summary of, 142types of, 116–132use with LINQ queries, 517–550

ASP.NET web applications. see web applications

ASP.NET Web Forms Site, 36ASP.NET Web Site (Razor v1 / Razor

v2), 36AspNetCompatibilityRequirements

attribute, 365<asp:Table> control, 132ASPX pages

accessibility of, 603AddEditReview.aspx page, 580creating templates for, 225CSS on, 67display process, 9dynamic files, 711events raised by, 564Response property, 276and review retrieval, 664SQL for database access in, 421testing code examples with, 146user control similarities with, 286

assemblies, 745, 766assignment operators, 158

asynchronous calls, 349, 377Asynchronous JavaScript And XML. see AjaxAsyncPostBackErrorMessage property, 357@ Register directive, 290, 294, 310duplicate of <a> elementAtkinson, Paul, 436AttachDbFileName, 466Attachment class, 334[attribute] filter, 403attr(attributeName, value) method, 405attr(attributeName) method, 405attributes

<add> element, 645defined, 365, 383HTML, 14, 15, 60, 319Membership provider, 624tracing, 720

[attribute=value] filter, 403<audio> element, 14authentication, identity, 604–605, 642authentication element, 611authorization rules, 605, 642Authorized column, 445AutoID property, 296automatic properties, 193AutoPostBack, 125, 242, 548Autos window, 704Average operator, 509a:visited selector, 92Aziz, Atif, 697

B

BackColor property, 114, 555backing variables, 191backward-compatibility, 386banner display, 288, 298base pages

creating, 221–225defined, 252

bindex.indd 809bindex.indd 809 10/4/2012 9:56:32 PM10/4/2012 9:56:32 PM

810

Basic Settings mode – C#

implementing, 221inheritance from, 218–219

Basic Settings mode, 17BegASPNET folder, 37Beginning ASP.NET Web Pages with

WebMatrix, 36Beginning CSS: Cascading Style Sheets for

Web Design (Pouncey and York), 87Beginning Microsoft SQL Server 2012

Programming (Atkinson and Vieira), 436Beginning Microsoft Visual C#, 146Beginning Visual Basic 2012, 146Beginning Web Programming with HTML,

XHTML, and CSS, 16BETWEEN operator, 430bigint data type, 442binary/varbinary data type, 442Bind, 491binding

control, 465data, 465, 478, 491expression, 478outer Repeater, 665two-way, 535

Bind(PropertyName), 535, 538bit data type, 441bloat, page, 559, 562Block Format, 55<body> element, 12, 396Body column, 444BodyContent, 7Boolean types, 147, 151boolean values, 513border, 78border property, 94BorderColor property, 114, 555BorderStyle property, 114, 555BorderWidth property, 114, 555bound fields, 461BoundField, 473

box model, CSS, 78breadcrumb, 259, 274–276break loop, 176breakpoints

client-side JavaScript, 710defined, 698, 728execution of, 708hitting and code stoppage, 701

Breakpoints window, 704browsers

debugging tools, 354, 709–712image re-sizing, 549interaction with the server, 10, 350sending cookies to, 238settings for cookies, 242viewing pages in different, 92work with outdated CSS, 360

bulleted lists, 60BulletedList control, 118, 513bundling, 738–740Button control

adding a, 109–113CommandName, 534postback from, 138skin for, 247–248Toolbox, 21

:button filter, 403ButtonField, 473buttons, 20

C

C#access modifiers, 200array instantiation, 153attributes, 365caching with, 593cross-language communication, 149declaring variables in, 147examples as given in, 50

bindex.indd 810bindex.indd 810 10/4/2012 9:56:32 PM10/4/2012 9:56:32 PM

811

cache dependency – client side

LINQ syntax, 498methods, 178parameter lists, 179resources on, 146as strongly typed, 506type casting, 152VB.NET code similarities, 53web application projects with, 38

cache dependency, 590cache invalidation, 590cached copies, 67caching, 589–599

API, 594–599defined, 589, 602drawbacks of, 589–590invalidation, 590, 602options, 590–594output, 502, 591

calculatorcreating, 170–173optimizing, 181–183

Calculator class, 379Calculator instance, 183Calendar control, 131Call Stack window, 704callback method, 366CallerMemberName attribute, 567camel case, 148case, type

camel case, 148Pascal case, 366

case sensitivityof CSS, 69, 70JavaScript, 375of jQuery, 393and SQL language, 429

case statement, 173casting data types, 151–152Catch block, 683, 688C:\BegASPNET\Site, 37, 39

centralized base pages, 218–219chaining, 420ChangePassword control, 621char/nchar data type, 441Chart control, 456CheckBox control, 135:checkbox filter, 403CheckBoxField, 473CheckBoxList control, 122, 656, 660child elements, 259, 260ChildrenAsTriggers property, 355class attributes, 268Class selector, 73, 398, 400classes

abstract, 199App_Code folder for files of, 180defined, 151, 190event argument, 201EventArgs, 574files, 43, 146inheritance in, 197instances of, 183namespaces of, 186with properties from Web.config file, 733static methods, 379System.Net.Mail namespace, 334

classic ASP, 1Clear Styles button, 99click events, 396, 405client IDs

controls, 217passing to JavaScript, 331understanding/managing, 295

client sideAjax script library, 349code, 373–378, 379, 709–712JavaScript files, 372page communication with web service,

369validation, 314, 327, 347

bindex.indd 811bindex.indd 811 10/4/2012 9:56:32 PM10/4/2012 9:56:32 PM

812

ClientID property – complex events

ClientID property, 330ClientIDMode property, 218, 296, 331ClientIDRowSuffix property, 455code

added to Toolbox, 26addition of handler code to, 125aid IntelliSense, 51for anonymous profile cleanup, 672BodyContent, 7–8bugs in, 680calling services from client-side, 365–366Code Behind vs. inline, 49compilation, 146for cookies, 238effects on page display, 10executing, 700experimenting with, 146files, 43hand-coding data access, 579–588hard-coded settings, 730–731highlighted, 224HTML. see HTML (HyperText Markup

Language)JavaScript shortcoming, 385jQuery, 392, 396, 406, 408moving in debugged, 701–702organizing, 177–188style sheet, 72for text formatting, 57typos in, 242using minimal, 203

Code Behind filesadding to site, 49–53caching code, 598in code compilation, 146code handler addition in, 125hand-coding, 585vs. inline, 49, 62namespace viewing through, 184storage of class, 504

Code Only profile, 17code snippets

ease of adding CSS, 67for inserting validation controls, 315for linking web pages, 62LoginView control, 614rules, 71usefulness of, 68

CodeBehind.aspx page, 51CodeInline.aspx, 52CollapseImageToolTip property, 270CollapseImageUrl property, 270collections, 154–155color property, 96columns

configuring, 473ID storage of user profile, 651styling, 562

Combined selector, 73, 398, 400CommandField column, 461, 473CommandName, 534commands

keyboard shortcuts for, 27package, 389

commentsC#, 186VB.NET, 186CSS, 90HTML, 14writing, 186–188, 203

Common Type System (CTS), 149CompareValidator control, 322comparison operators, 161compatibility, backward, 386compilation

code, 146errors, 680recompilation, 649

compiler, 680complex events, 564

bindex.indd 812bindex.indd 812 10/4/2012 9:56:32 PM10/4/2012 9:56:32 PM

813

CompositeScript property – CreateUserText property

CompositeScript property, 357concatenation operators, 163conditions, 157confirmation email, 619–621connection strings, 465, 495, 611, 650ConnectionString attribute, 523connectionStringName attribute, 624constructors, 195–197contact form animation, 410–414ContactForm user control, 341–345ContactForm.ascx, 315, 358container controls, 122, 143:contains(text) filter, 403content

HTML tags for rendering, 11personalized, 643user controls to manage, 286

Content block, 401Content control, 216, 218Content Delivery Network (CDN), 387, 392content pages

adding user controls to, 290–293ContentPlaceHolder, 212–215defined, 208, 252user controls to manage, 285

ContentPlaceHolder control, 211–212, 216, 218, 398

ContentTemplate property, 355ContextTypeName property, 518Continue For loop, 177continue loop, 177ControlParameter, 466controls. see also ASP.NET Server Controls;

data controlsbind, 465client ID of, 217ClientIDMode property, 296ContactForm user, 341–345content, 212data source, 456, 494, 495, 574–579, 592

data-bound, 454–455, 494, 535, 536–538, 555–557

events, 572formatting with styles, 554–555hand-coding form, 585HTML vs. Standard, 132–133life cycle of, 564–569login. see login controlsrelative URLs in server-side, 256state storage for, 135style declarations, 563user. see user controlsusing navigation, 257–276validation, 313–314and View State reliance, 140Web.sitemap file for, 258

Controls folder, 46ControlsDemo.aspx page, 25ControlToCompare property, 323ControlToValidate property, 314, 317, 320,

654Convert class, 151converting data types, 150–152CookieParameter, 466cookies

added to debugging code, 697authentication, 612browser settings on, 242defined, 252how to install, 238privacy and, 239

Cookies collection, 243Copy method, 340Copy Web Site, 742copying

style sheet file, 67websites, 741–745

Count operator, 509CreateDateTime column, 445, 586CreateUserText property, 608

bindex.indd 813bindex.indd 813 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

814

CreateUserUrl property – data

CreateUserUrl property, 608CreateUserWizard control, 617–621, 626Criteria pane, 432Cross Page Postbacks, 138CRUD operations

accessed via EntityDataSource control, 518

defined, 440, 460preventing errors during, 574in relational databases, 452via LINQ to SQL operations, 499

CSS (cascading style sheets) languageadding to web pages, 85–87applying styles, 98–100Box Model, 78case sensitivity of, 70creating embedded and inline style sheets,

93–98CSS Editor, 88–92defined, 65exercises with, 104files, 45, 738vs. HTML, 66–67image files, 237language parts, 72–79markup vs. HTML tables, 57methods, 404–405for organized item display, 534outdated versions of, 360practical tips for, 102–103practice writing, 68–71support for, 65syntax, 397

CSS Methodscss method/addClass method/

removeClass method/toggleClass

method, 404applying elements to, 396, 400applying matched sets to, 406background color change via, 401

(name), 404(name, value), 404(properties), 404

CssClass propertydata-bound controls, 556Label control, 598Menu control, 261of server controls, 114TreeView control, 270validation control, 320

CssDemo.aspx, 68customErrors element, 691CustomValidator control, 327–332

D

DarkGrey theme, 231, 233data

access code, hand-coding, 579–588added to the trace, 723–724binding, 465, 478, 491-bound controls. see controls, data-boundcaching, 589creating, 437deletion, 438, 526–536displaying and editing, 456–462editing, 456–462encapsulation, 192exercises with, 494filtering, 429, 466–472flows, 311hashing, 624insertion, 463–464, 479–493, 526–536joining, 434–437ordering, 430paging, 544, 550presentation, 66processing at the server, 334–345querying, 498reading with SQL, 427–438

bindex.indd 814bindex.indd 814 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

815

data controls – debugging

reliance on cached, 590selecting from sample database, 431–434server access to, 363shaping with anonymous types, 511–513SQL for managing, 425stale, 502, 590storage, 238, 239, 644, 652–656stores, 606, 607summary of work with, 494tips, 701, 728types and variables, 147updating, 438, 493validating, 312work in sample database, 438–441

data controlscustomizing appearance of, 472–473data-bound, 454–455, 473–479, 494, 535Entity Framework work with, 500EntityDataSource control, 517–524events, 569ListView control, 524–536strongly typed data-bound, 536–538use of with EF, 517

data files, 44data models, 501–507, 552data source, 455, 589data types. see also types

converting and casting, 150–152creating for properties, 297–298HTML5, 317–320namespaces as organizing, 184non-standard Profile, 647resources on, 147SQL Server, 441–442variables and, 147–151

Database Explorer, 19, 457databases, 421–452

access exceptions, 689adding tables to, 443attached to the SQL server, 465

creating sample SQL Server, 425–427defined, 422–423editing reviews, 586EF design with relationships in, 504exercises with, 451exporting Planet Wrox, 760filtering, 466for login page creation, 611objects, 500password storage in, 624practical tips for, 450re-creation, 762–763relational, 422selecting data from sample, 431–434summary of, 451table relationships for consistent, 446work with sample, 438–441

DataBind, calling, 507, 516, 517data-binding expression syntax, 465DataItem property, 573DataList control, 454DataNavigateUrlFields property, 475, 478DataNavigateUrlFormatString property,

475, 478DataPager control, 455, 517, 544–549DataSet class, 499DataSource property, 507, 514, 516DataSourceID property, 261, 507, 526DataTextField property, 475, 514DataValueField

date, absolute expiration, 598date data type, 441dates, 147datetime data type, 441datetime2 data type, 441debugger keyword, 712debugging

browser tools, 354defined, 728extensive, 705–709

bindex.indd 815bindex.indd 815 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

816

decimal data type – DynamicEnableDefaultPopOutImage property

introduction to, 698moving in debugged code, 701–702with Page Inspector, 712–718practical tips for, 725summary of, 726web application how-to, 698–701windows, 702–705

decimal data type, 441decision making, 157, 166–169declaration

control, 292CSS, 71of validation controls, 313of variables, 147

default documents, 257default value, 446Default Web Site, 752Default.aspx page

adding Modernizr to, 83BodyContent, 7in PhotoAlbums folder, 673styling with, 82for web page linking, 61web server for displaying, 9

DefaultMembershipProvider, 607, 631DefaultRoleProvider, 607, 631defaultValue attribute, 646Delete method, 340DELETE statement, 438, 440DeleteParameters, 460, 495#DemoTable element, 406Demos folder, 52, 68dependency, cache, 590Description column, 519Design View

addition of handler code in, 125defined, 64vs. Source View, 48in user control creation, 291

designer file, 504

DetailsView controlto allow user photo upload, 518customizing, 484–493data insertion/update with, 463–464,

479, 480–483as data-bound, 455page styling, 483replacing, 580

diagnostics tools, 712Diagram pane, 432disabling

skins, 249toolbars, 27

DisappearAfter property, 261Display property, 320, 654DisplayAfter property, 358DisplayDirection property, 301, 306displaying data, 456–462DisplayMode property, 514<div> element, 14DLL files

as compilation result, 146namespaces, 184

DOCTYPE, 15Document Window

buttons, 19–20customizing the, 26–27modifications, 25–26

documents, default, 257Dojo, 386$(document).ready, 394$ function, 395, 397, 413DOM (document object model), 396, 404–408DropDownList control, 118, 467, 469, 549Dynamic Data Entities Web Sites

controls, 134as template option, 36

dynamic files, 711DynamicEnableDefaultPopOutImage property,

261

bindex.indd 816bindex.indd 816 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

817

DynamicLayout property – errors

DynamicLayout property, 358

E

each method, 407<EditItemTemplate>, 525Editor, CSS, 88–92EditRowStyle, 557EF (Entity Framework). see ADO.NET Entity

FrameworkElement selector, 397, 400elements

CSS, 72, 84, 85HTML, 11–14, 14, 15, 32, 60, 66, 78,

85, 86, 217, 295jQuery, 418matched set of, 397replacing, 533service, 375

ELMAH (Error Logging Modules and Handlers project), 697–698

Elseif statement, 166e-mail

creating messages, 336–340error alert e-mails, 697errors in, 338exceptions, 689password recovery, 624Secure Sockets Layer (SSL), 335sent from ContactForm user control,

341–345sent from your website, 334–340signup confirmation, 619–621

embedded<style> element, 85style sheet creation, 93–98

Empty Web Site templatedefined, 36page creation with, 20, 39for Planet Wrox site, 36

<EmptyDataTemplate>, 525EmptyDataRowStyle, 557<EmptyItemTemplate>, 525EnableCdn property, 357EnableClientScript property, 320enabled attribute, 720Enabled property, 114EnableDelete property, 518EnableInsert property, 518EnablePageMethods property, 357, 378EnablePartialRendering property, 357enablePasswordReset attribute, 625enablePasswordRetrieval attribute, 624EnableUpdate property, 518enabling toolbars, 27encapsulation, data, 192, 200, 286EndRequest event, 677Entity Data Model files, 44Entity Framework. see ADO.NET Entity

Frameworkentity sets, 504, 552EntityDataSource control, 517–524

attaching to ListView, 532connecting DropDownList to, 549as data source control, 456defined, 552event handling, 541hooking CheckBoxList control to,

656Inserting event, 535, 538Inserting event handling, 526item deletion with, 639meta data error, 520

EntitySetName property, 518enumeration (enum), 297–298= operator, 429:eq(index) filter, 402Error List window, 22ErrorMessage property, 317, 320, 321, 654errors. see also exceptions

bindex.indd 817bindex.indd 817 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

818

European cookie law – external style sheets

invalid theme, 271pages, custom, 690–698troubleshooting web server,

757–759types of, 680–682validation control, 313

European cookie law, 239Eval property, 516Eval(PropertyName), 534, 535, 538:even filter, 402event handling

defined, 201DetailsView control, 484–493EntityDataSource control, 541and exception throwing, 224Inserting event, 526ItemCreated, 639jQuery, 405–407page life cycle and data, 569Page_Load, 306postback, 220understanding, 563

EventArgs, 574event-driven environments, 201events

complex and simple, 564defined, 201–202GridView control, 569handling, 201, 220jQuery, 396styles as, 555submit event, 413

Events tab, 129, 143exception handling, 685–690

blocks, 683–684data source controls, 574defined, 679, 728of events, 224exercise with, 685–690global, 690–698row deletion, 575–579

summary of, 726Try/Catch/Finally, 683–689Exception instance, 697Exception property, 575, 578Exception type, 684, 688ExceptionHandled property, 575exceptions. see also errors

catching, 682–685defined, 502, 728“File not found”, 695foreign key constraint error,

578404 exception, 696possible sources of, 689resources on, 697summary of, 726validation control, 313

executionbreakpoint, 708path, 680tracing page, 719

Exists method, 340Exit For loop, 176exiting loops, 176ExpandDepth property, 270ExpandImageToolTip property, 270ExpandImageUrl property, 270experimentation, programming,

203Expert Settings mode, 17Export Template, 250expressions

binding, 478in decision making, 168defined, 161syntax of, 465, 495, 731,

766Ext JS, 386extending themes, 235external <style> element, 85external style sheets, 100

bindex.indd 818bindex.indd 818 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

819

fadeIn – <form> element

F

fadeIn() effect, 409fadeOut() effect, 409fadeTo() effect, 409FavoriteGenres profile, 648, 656–661, 664fields

bound, 461configuring, 473defined, 190

File classExists method, 340ReadAllText method, 340WriteAllText method, 340

defined, 347System.IO namespace, 340

:file filter, 403“File not found”, 695files

adding, 42–43, 44–45App_Code folder for, 180ASP.NET types, 41–42code, 43Code Behind, 49data, 44dynamic, 10, 711exporting data to, 760extensions, 45, 740project, 34reading from text, 340–345separate style sheet, 67skin, 246–247special types, 47synchronizing, 744text, 245types, 64upload exceptions, 689Web.sitemap file, 258–260zip, 228

filesystem configuration, 754–757filesystem deployment, 741

FileUpload control, 131, 541, 542filters

data, 429, 467–470, 470–472database, 466jQuery, 395, 400, 402, 402–403, 420

Finally block, 683Find Results window, 23FindControl, 573Firebug, 354, 713Firefox, 354, 713:first filter, 402First operator, 511FirstOrDefault operator, 511flicker-free pages, 349, 358–362float data type, 441float property, 84floating windows, 23folders, 46font

color, 69size, 69

Font property, 114, 556<font> element, 66<footer> element, 12FooterStyle, 557For Each (foreach) loop, 175For loop, 173foreach loop, 122ForeColor property, 114, 555foreign keys

constraint error, 502, 578, 579introduction to, 423in relational databases, 452in table relationships, 446

Formatting menu, 58–60formatting text

adding, 55–57CSS for, 67and inserting, 54style shortcomings of HTML, 66–67

<form> element, 149

bindex.indd 819bindex.indd 819 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

820

<form> input controls – handling

<form> input controls, 13FormParameter, 466forms. see also Web Forms

animating contact, 410–414collections, 697contact, 323–326hand-coding controls, 585Wizard control for, 125

FormView control, 455404 exception, 696From clause, 508FROM keyword, 428FTP site deployment, 741functionality, 396functions, 177–179

G

generics, 155–157, 507Genre property, 505Genre table

avoiding exceptions in, 588data insertion, 464handling row deletion errors, 575–579modifications, 572pluralizing in, 504relationships, 450in sample PW database, 427, 439

GenreId column, 445Genres collection, 506Genres page, 570Genres.aspx, 559GET method, 143, 312getElementById, 385Get-Help NuGet, 389Get-Package command, 389GetProfile, 675Gig Pics feature, 544, 672GigPics folder, 754Global Application Class files, 43

global exception handling, 690–698Global.asax, 414, 420, 697Gmail, 335Golding, Todd, 157Google Chrome, 354Google Code, 392> operator, 429>= operator, 429GridView control

attributes, 461customized columns, 473–479for data retrieval, 456as data-bound, 454DataSource property, 507enhancing with styles, 557–559, 562handling row deletion errors, 575–579ListView as compared with, 524output events, 569review display, 470RowDataBound event, 570–574styles, 555, 556View State control reconstruction,

569visual styling of, 554

GridViewRowEventArgs, 573grouped selectors, 73, 398, 400groups, profile, 645, 646, 677<GroupSeparatorTemplate>, 525<GroupTemplate>, 525:gt(index) filter, 402Guid class, 543

H

h1 element, 71hand-coding, 579–588Handle the Save button, 579handler code, 125Handler Mapping, 10handlerName parameter, 567handling, event. see event handling

bindex.indd 820bindex.indd 820 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

821

hard-coded settings – IIS Express

hard-coded settings, 730–731:has(element) filter, 403hash symbols, 408hashed, passwords, 624Hashtable, 155<head> element, 12<header> element, 12, 80header filter, 402HeaderStyle, 557HeaderText property, 475<head> section, 70Height property, 114, 556“Hello World” web service, 369HelloWorld, 366, 376:hidden filter, 403HiddenField control, 132hide() effect, 408hierarchical indents, 87, 90Home node, 260HorizontalAlign property, 556hotspots, 131:hover selector, 92href attribute, 62, 85HTML (HyperText Markup Language)

added to web pages, 55–57applying CSS to, 103attributes, 14Button control, 248calling services from client-side, 365comments, 14controls, 132–133defined, 32elements and tags, 11–14exceptions, 332–333Format and Table menu, 62generated by ASP.NET markup, 16inspecting, 713on master pages, 212page, 42in page display process, 9rules of HTML5, 14–16

sent by server to browser, 350shortcomings of, 66–67Source View to see, 48tables, adding, 57

<html>, 12HTML5

data types, 317–320as latest version, 11rules of, 14–16

HTTP (HyperText Transfer Protocol)in browser/server process, 10defined, 32as stateless, 134

http://imar.spaanjaars.com, 765http://p2p.wrox.com, 765Hungarian Notation, 148HyperLinkField, 473

I

ID attribute, 108, 217Id column

Genre table, 464Gig Pics feature, 518INSERT statement, 437in table creation, 440, 444, 450

ID property, 513ID selector, 73, 398, 400, 408Identity columns, 437–443identities, 442, 452, 604_id variable, 586, 587If Else statement, 166If statement, 166IIS

defined, 766deployment, 741installing/configuring, 746–749running a site under, 746security, 753support, 747

IIS Express, 8–9, 10

bindex.indd 821bindex.indd 821 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

822

IIS:ASP.NET – interface

IIS:ASP.NET, 748Image control, 131, 288:image filter, 403ImageButton control, 131ImageField, 473ImageMap control, 131images

adding to themes, 235–238CSS styling of, 86Gig Pics feature, 518ImageMap control, 131large photo album uploads, 543–544pageable list of, 544sizing, 534–535supplying to albums, 548user control for banner display,

288, 297ImageUrl column, 519<img> element, 13Immediate window, 705, 708Include Foreign Key column, 535IncludeStyleBlock property, 261inference, type, 506, 512, 552informational windows, 22–23Inherit property, 296inheritance, 197–200

from base page, 218–219, 223, 225in the Entity Framework, 504

initialization, page, 219InitialValue property, 317inline code

Code Behind vs., 49, 62commenting, 186–187Markup View, 64

Inline Style, 100inline style sheets, 93–98, 563INNER JOIN, 434, 435<input> element, 13:input filter, 403Insert method, 598

INSERT statement, 427, 437, 440InsertCommand, 492Inserting event, 526, 538, 542inserting text, 54insertion, data, 463–464, 479–493<InsertItemTemplate>, 491, 525, 538InsertItemPosition property, 526InsertParameters, 460, 495installed packages, 388Installed Templates, 7Install-Package command, 389instances

of classes, 183named, 465, 495of objects, 189

instantiationof arrays, 153of objects, 189

int data type, 442integrated development environment (IDE)

customizing the, 23–26, 31debugging features, 711defined, 32editing with Page Inspector, 713tour of Visual Studio's, 16user control design experience in,

290Integrated Pipeline mode, 752, 766IntelliSense

for anonymous type creation, 512in code files with enums, 298code for jQuery library, 391, 393, 395,

410as code-writing aid, 51comments as appearing in, 188in skin files, 246–247VS 2012, 14, 87WCF discovery by, 376

interface, userAjax to prevent interruption of, 349

bindex.indd 822bindex.indd 822 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

823

Internet Explorer – keys

exceptions appearing in, 682hand-coding, 580

Internet Explorer, debugging, 709–712invalidation, cache, 590, 602IsUserInRolemethod, 637IsValid property, 321, 332ItemDeleted event, 479ItemDeleting event, 479ItemInserted event, 479ItemInserting event, 479, 492, 541ItemPlaceholderID property, 526Items collection, 118<ItemSeparatorTemplate>, 525<ItemTemplate>, 525, 534, 538, 549ItemType property, 536, 538ItemUpdated event, 479ItemUpdating event, 479, 492iteration, 155

J

JavaScriptasynchronous, 349bundling/minification of, 738case sensitivity of, 375debugging, 709–712defined, 32HelloWorld, 366jQuery library as, 392and Modernizr, 82shortcomings of, 385unobtrusive validation, 414–418validatePhoneNumbers, 330writing, 327

JavaScript File, 42JavaScript Object Notation (JSON), 368,

371JOIN statement, 434, 436, 452jQuery, 385–420

adding to master page, 393–395vs. Ajax script library, 350code run time, 396core functionality, 396defined, 420demo page setup, 400–402effects, 408–410event handling, 405–407exercises with, 419filters, 400–403installation of latest package, 390introduction to, 386library inclusion methods, 392miscellaneous functionality, 407mistakes, common, 394, 408new verion of, 386, 392onclick attribute alternatives, 378power of, 414, 417practical tips for, 418reference location on website,

391, 394for styling, 562summary of, 418syntax, 395–396UI project, 418validation controls, 326, 414–418website reference to, 391

jquery-1.7.2.js, 391jquery-1.7.2.min.js, 394Juice UI, 418jQuery UI

K

keyboard shortcutscustomizing, 27for moving in debugged code, 702

keys, primary and foreign, 423, 442, 446

bindex.indd 823bindex.indd 823 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

824

Label control – logical operators

L

Label controladding a, 109–113, 118appending, 122CssClass property, 598and LINQ, 499and maintenance of state, 135Photo Album page, 675property association with TextBox, 653,

656Web Forms, 50

language, 499:last filter, 402Last operator, 511LastName property, 651LastOrDefault operator, 511layout, window, 28<LayoutTemplate>, 525lazy loading, 505, 552LEFT OUTER JOIN, 435Lerman, Julia, 500, 588< operator, 429<= operator, 429libraries

IntelliSense code for, 410JavaScript, 386Modernizr, 83NuGet package manager, 387–391online versions of external, 392

Library Package Manager, 387life cycles

control, 564–569page, 219–220, 252profile changes during page, 651

LIKE operator, 430LinkButton control, 131<link> element, 85LINQ (Language-Integrated Query)

to ADO.NET, 499–500

defined, 552exercises with, 551integration with .NET, 497introduction to, 498–499for mapping data models, 501practical tips for, 550queries, 504–505, 506, 507–511,

513–517, 517, 517–550, 663summary of, 550

LINQ queries, 504LinqDataSource control, 456list controls

data-bound, 454–455FavoriteGenres property,

660list of, 118–123POST method, 143

ListBox control, 118ListItem Collection Editor, 122ListItems control, 122lists, tags for, 13ListView control, 524–536

customizing templates, 538–544as data control, 517as data-bound, 454Inserting event, 542item deletion with, 639<ItemTemplate>, 549pageable image list with, 544as strongly typed, 538

ListViewInsertEventArgs, 541Literal control, 131loading, lazy, 505, 552local ISS deployment, 741LocalDB, 423Localize control, 131localOnly attribute, 721Locals window, 704, 708logic errors, 681–682logical operators, 164

bindex.indd 824bindex.indd 824 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

825

logical structure – methods

logical structure, 281Login control, 612login controls

creating logins, 607–612defined, 642exercises with, 615–617HTML, 133list of, 612–624login as Manager, 635–636Login.aspx, 215for state storage, 135

LoginName control, 615LoginStatus control, 615, 617LoginView control, 614, 617, 636loops, 157, 173–177:lt(index) filter, 402

M

Machine.config file, 310MailAddress class, 334MailMessage class, 334, 336main menu, 17–18MainContent element, 84, 394–395making decisions, 166–169Manage NuGet Packages dialog box, 387–

389, 390Manage Styles window, 87, 101Management folder, 632, 635Management section, website, 457ManagePhotoAlbum.aspx, 533, 665, 670Managers role, 614, 627, 632, 635, 640, 665margin property, 94margins, 78markup

adding table, 60skin vs. button, 246

Markup Viewadding text in, 55–57addition of handler code in, 125

changing page links from, 61content placeholders, 215defined, 64modifications, 25–26previewing in, 20Source View as, 48typing server control markup in, 113

master pages, 239–243adding jQuery to, 393–395adding user controls to, 290–293caveats on, 217–218consistent layout with, 208–209content placeholders, 215–216creating, 210–212defined, 252different views on, 47for dynamic theme change, 239–243managing page bloat, 562nesting, 216–217ScriptManager control, 372tips on, 249user controls to manage, 286Web Forms, 42

matched set of elements, 397, 406, 420Max operator, 509MaximumDynamicDisplayLevels property, 261MaximumValue property, 322maxInvalidPasswordAttempts attribute, 625membership, 605, 642Membership provider, 624–627Menu control, 257, 261–269, 283menus, 58–60meta data error, 520MetaDescription property, 502, 599MetaKeywordsproperty, 502methods

adding to user controls, 296–297callback, 366defined, 194File class, 340

bindex.indd 825bindex.indd 825 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

826

functions and subroutines, 177–179overriding, 198page, 363, 378–381, 383page load, 567signatures, 178syntax, 511WCF services as, 371web services, 364

Microsoft Developer Network (MSDN), 130, 147, 556

Microsoft Intermediate Language (MSIL), 146

Min operator, 509minification, 738–740MinimumValue property, 322minRequiredNonalphanumericCharacters

attribute, 625minRequiredPasswordLength attribute,

625mode attribute, 611, 612Model View Controller pattern, 34models, 501–507Modernizr, 11, 82modulus operator, 159Monochrome theme, 231, 234, 266mostRecent attribute, 721mouseover events, 396Move method, 340MultiView control, 123myEntities object, 505

N

name attribute, 646name collisions, 184Name column, 518, 554Name property, 515named instances, 465, 495named skins, 248–249, 252

namesclient ID, 295invalid page titles, 232page folders, 282usernames, 604, 621of users in profile configuration, 645of web pages, 219

NameService, 375namespaces

creating, 185e-mail, 339introduction to, 184–186System, 150

naming containers, 295NavigateUrl property, 302navigation, 253–283

absolute and relative URLs, 254–257controls, 133, 257–276, 271, 555exercises with, 282forms of, 254practical tips for, 281–282programmatic redirection, 276–281summary of, 282

nestingmaster pages, 216–217Repeater control, 664

.NET Frameworkassemblies, 745, 766classes, 151database tools, 422LINQ integration with, 497, 498, 499namespaces as organizing, 184object orientation (OO), 1891.0, 11.1, 2resources on types in, 147

network communication technology, 364New Photo Album, 669New SQL Server installation, 424New Style Copy, 100

Microsoft Developer Network – New Style Copy

bindex.indd 826bindex.indd 826 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

827

Planet Wrox – programming

New Web Site dialogpage creation with, 20templates contained in, 35–37as VS template, 6–7

nodes, root and child, 259Not operator, 164<> operator, 429NTFS, 754–757NuGet, 387–391, 420, 624Numbered List, 60numbered lists, 60numbers, 147

O

object orientation (OO), 189–202Object Relational Mapper (ORM), 500ObjectContext object, 504ObjectDataSource control, 456object-relational designer, 504objects

constructors to create instances of, 195defined, 189Entity Framework work with, 500inheritance, 198lazy loading of, 505LINQ to, 499model, mapping data model to, 501–507returning strongly typed, 510

:odd filter, 402online packages, 388OnMigrateAnonymous event, 677\ operator, 159Operation Contract, 364Operator property, 323operators, 158–166

^ operator, 159standard LINQ query, 507–511WHERE clause, 429

Optional keyword, 568optional parameters, 568Options dialog, 31Or operator, 164, 430ORDER BY clause, 430, 508Order By property, 518ordered lists, 60OrElse operator, 164Orientation property, 261OUTER JOIN, 435output caching, 591Output window, 22–23overloads, 277overriding methods, 198

P

p2p.wrox.com, 604Package Manager Console, 83, 389–390, 697packages

Manage NuGet Packages dialog box, 387–389

NuGet installation of, 390–391Package Manager Console, 389–390types of, 388

padding, 78padding property, 94Page class, 599, 672Page Inspector, 712–718Page Load event, 405page methods, 363, 378–381, 383page request, 219PageMethod attribute, 380, 381pageOutput attribute, 720PagerStyle, 557pages, web

ASP.NET display process, 9ASP.NET windows used for, 22–23centralized base, 218–219

bindex.indd 827bindex.indd 827 10/4/2012 9:56:33 PM10/4/2012 9:56:33 PM

828

PageWrapper element– PhotoAlbumId property

content pages, 208, 212–215creating a first ASP.NET, 20CSS additions, 85–87custom error, 690–698defining server controls on, 113DOM loading, 396exercises with, 250–251flicker-free, 349, 352–357, 358–362homepage styling, 79–85improving performance of, 559invalid titles of, 232, 597jQuery demo, 400–402jQuery for dynamic, 418life cycle, 219–220, 252, 564–569,

569linking, 60–62loading, 67, 220, 569master pages. see master pagespage-level themes, 230–231partial refresh of, 366, 372personalized, 644practical tips for, 249–250pre-compiling, 745previewing in VSEW, 20programmatic redirection to other,

276–279reload after postback, 351reusable templates for, 225–229routing to link, 281signup and login, 607–612skins, 245–249Source vs. Design View of, 48starting, 219static vs. dynamic display, 10subsequent requests to, 591summary of, 250text markup additions, 54–57themes, 229–245trace data additions, 723–724tracing, 719

UpdatePanel control additions to, 352–356

PageWrapper element, 84paging control, 455Panel control, 123–126Parameter, 466parameterization, 177parameters

HelloWorld, 366Insert method, 598lists, 179optional, 568SqlDataSource control, 460

parent method, 407Pascal case, 366:password filter, 403passwordAttemptWindow attribute, 625passwordFormat attribute, 625PasswordRecovery control, 621passwords

authentication of, 604changing default settings, 624implementing functionality in, 621–624

passwordStrengthRegularExpression attribute, 625

path, execution, 680PathDirection property, 274paths, virtual, 344PathSeparator property, 274performance, tracing and, 725permanent redirect, 277, 283permissions, 605, 642personalized content

defined, 677importance of, 643for logged-in user, 644practical tips for, 675

PhotoAlbum table, 523, 669PhotoAlbumId column, 519, 533PhotoAlbumId property, 535

bindex.indd 828bindex.indd 828 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

829

photos – <group> element

photos, uploading, 518Picture table, 523, 541Pictures entity, 532PlaceHolder control, 123placeholders

content page, 209, 215template, 228

Plain Postback, 139Planet Wrox

adding text to homepage of, 55–57as basis for new sites, 764bundling/minification of, 738database creation, 425–427exporting database, 760Gig Pics feature, 518, 544homepage styling, 79–85link styling, 91master page example, 210NTFS settings, 754–757Profile in reviews page, 661–665relational databases, 422–423as sample application, 30table relationships, 447web services, 369website creation, 37–39

plug-ins, jQuery, 417POST method, 143, 312postback

Cross Page Postbacks, 138defined, 143DisplayDirection property, 306event handling, 220events raised by, 568page load after, 21–22, 351, 356in Server Control addition, 110

Pouncey, Ian, 87Predictable property, 296Preference type, 647PreInit event, 238, 244premature loop exit, 176

PreRender event, 220presentation, 66prev method, 407primary keys, 423, 442, 450, 452privacy, cookies and, 239Private fields, 190Private keyword, 192production servers, 729Professional ASP.NET 2.0 Design: CSS,

Themes, and Master Pages, 764Professional ASP.NET 4.5 in C# and VB,

580, 588, 590, 697, 764Professional CSS: Cascading Style Sheets for

Web Design, 3rd Edition, 764Professional JavaScript for Web Developers

(Zakas), 327Professional LINQ, 765Professional Microsoft IIS 8, 765Professional .NET 2.0 Generics (Golding), 157Professional Search Engine Optimization

with ASP.NET: A Developer’s Guide to SEO, 599

Professional WCF 4: Windows Communication Foundation with .NET 4, 364

profile groups, 645, 646, 677Profile property, 672Profile service<group> element, 646

anonymous identification, 670–671cleaning up old profiles, 671–672configuring, 645–648creating a profile, 648–651defined, 677exercises with, 676introduction to, 644–645providers, 650, 677reading from and writing to, 652reading non-current user profiles,

672–675

bindex.indd 829bindex.indd 829 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

830

Profi le.GetProfi le – ReadAllText method

storing FavoriteGenres in, 656–661storing user data, 652–656summary of, 675–676used in reviews page, 661–665

Profile.GetProfile, 671ProfileManager class, 672ProfileParameter, 466profiles, 605programmatic caching, 593programmatic redirection, 276–281programmatic role checking, 636–640programming. see also C#; VB.NET

code, 10cross-language communication, 149exercises with, 204introduction to, 146–147language, 50, 506object-oriented, 189–201practical tips on, 202–203summary of, 203themes, 231, 245

Programming Entity Framework (Lerman), 500, 588

projectsadding libraries to, 387adding WCF service to, 364files, 34templates, 64types (VS), 34–35

propertiesadding to user controls, 296–297and anonymous typing, 512–513automatic, 193CreateUserWizard control, 618creating data types for, 297–298CSS, 71, 75–76, 78–79defined, 191EventArgs, 574Login control, 613Menu control, 261, 265PasswordRecovery control, 621profile, 645, 646

read-only and write-only, 193of server controls, 113server-side control, 115–116for setting themes, 230SiteMapPath control, 274skinned, 246Style class, 555TreeView control, 270View State, 302–308, 310

Properties Gridfor creating embedded and inline styling,

95Events tab, 129manual entry of values on, 98Solution Explorer, 19style sheet, 87

Property keyword, 191Prototype, 386ProviderName attribute, 460providers, 606, 624, 642, 650, 677pseudo class selectors, 92Public function, 178public methods, 378publication, website, 745Publish Web Site, 745

Q

Query Designer, 434query strings, 277, 597, 697QueryStringParameter, 466

R

:radio filter, 403range variables, 508, 552RangeValidator control, 321Razor v1, 36Razor v2, 36ReadAllText method, 340

bindex.indd 830bindex.indd 830 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

831

readOnly attribute – Role Manager

readOnly attribute, 646read-only properties, 193ready function, 396recent packages, 388Redirect method, 277redirection, programmatic, 276–281redirectMode, 696RedirectPermanent method, 277_references.js, 420references, variable, 179registering controls, 290regular expressions, 347RegularExpressionValidator control, 322relational databases

defined, 422–423Entity Framework work with, 500foreign keys, 452kinds of, 423–424SQL for data management, 425

relationships, between tables, 446–450relative URLs, 254–256Release folder, 754remote site deployment, 741removeClass method, 404renaming files, 45RenderCurrentNodeAsLink property, 274rendering content

HTML tags for, 11jQuery library, 396, 418in response to postback, 21–22web page, 220

RenderingMode property, 262RenderMode property, 355Repeater control

data source of nested, 664as data-bound, 454Eval property, 516ListView as compared with, 524Profile service, 661

Replace method, 344, 347replacing elements, 533requestLimit attribute, 720

RequiredExpressionValidator property, 325

RequiredFieldValidator control, 315–317RequiredFieldValidator property, 325requiresQuestionAndAnswer attribute, 625requiresUniqueEmail attribute, 625:reset filter, 403Resig, John, 386Resource Not Found error, 522Response property, 276, 277Review class, 512Review folder, 661–665Review instance, 587, 594, 599Review objects, 505, 507Review property, 515Review table

css method, 401Entity Framework work with, 500pluralizing in, 504in sample PW database, 427SqlDataSource control collection from,

470reviews

accessed by genre, 500, 505database storage of, 421, 422editing, 586filtering by genre, 470hand-coding, 588and item deletion, 446JOIN statement to find, 434, 435, 436Management access to, 627, 632managing, 457, 466, 467, 480, 483retrieving from database, 366–367service call, 366, 368shown at the client, 368updating, 446using Profile to retrieve, 661–665

Reviews collection, 506rgba notation, 77RIGHT OUTER JOIN, 435RightAligned, 71Role Manager

bindex.indd 831bindex.indd 831 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

832

RoleGroups – server side

configuring, 627–628defined, 627, 642function of, 627managing users with WSAT, 628–632

RoleGroups, 637roles, user

defined, 605managing with WSAT, 628–632programmatic checking of, 636–640web application work with, 632–636

root-based relative URLs, 255routing, 281RowDataBound event, 570–574rows

deleting without error, 575–579profiles stored in single, 651

RowStyle, 556rule sets, 71rules, authorization, 605, 635run time

ASP.NET authentication, 611custom error pages, 696errors, 332–333, 682exception handling, 679files, 711inline vs. Code Behind code, 52IsUserInRole, 637.NET 4.0, 749–753page request processing, 635publication for, 745theme changes by users, 238

runat attribute, 108

S

screen, error message, 578scriptaculous, 386ScriptManager control, 355, 356, 372–373,

383ScriptManagerProxy control, 373, 383

Scripts folder, 386, 391Scripts property, 357search engine optimization (SEO), 599, 696<section> element, 12Secure Sockets Layer (SSL), 335, 338, 347security, 603–642

Everyone group, 757exercises with, 641in IIS, 753introduction to, 604–607login controls, 607–624navigation controls work with, 259practical tips for, 640Role Manager, 627–640summary of, 641of tracing, 725WSAT, 632

SELECT *, 450Select Case/switch statement, 168–169,

173<select> element, 13Select keyword, 508Select property, 518SELECT statement, 427, 435, 440SelectCommand, 477SelectedIndexChanged, 242<SelectedItemTemplate>, 525SelectedRowStyle, 556selecting data, 427selectors

declaring CSS, 71grouping and combining, 74–75jQuery, 395, 397–400, 420pseudo class, 92types of CSS, 73–74

SelectParameters, 466, 470, 482, 491, 495SendMailOnError setting, 737serialized reviews, 368server controls. see ASP.NET Server Controlsserver side

Ajax framework, 349

bindex.indd 832bindex.indd 832 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

833

Server.MapPath – SQL Server 2012 Express

controls, 115–116, 256functionality, 362ID, 217redirects, 279–281transfer, 283validation methods, writing, 327

Server.MapPath, 344Service Contract, 364, 365ServiceContract attribute, 365Services property, 357SessionParameter, 466SetFocusOnError property, 320settings, resetting, 28shared methods, 378shorthand CSS, 77–78show() effect, 408ShowExpandCollapse property, 270ShowLines property, 270ShowToolTips property, 274signup pages, 607–612simple controls, 116–117simple variables, 190Single operator, 510SingleOrDefault operator, 510Site Map, 42SiteMapDataSource control, 283SiteMapPath control

breadcrumb, 274–276to find Web.sitemap file, 259redirects, 283for users, 257

sizeof arrays, 154of header/PageWrapper/nav/footer,

84Skin File, 42SkinID attribute, 248–249skins

combining styles, themes and, 559–563named, 252web page, 245–249, 250

Skip operator, 509–510SkipWhile operator, 509–510slideDown() effect, 409slideToggle() effect, 409slideUp() effect, 409smallint data type, 442Smart Tasks panel

EntityDataSource control, 520list controls, 118–119and postback, 143

SMTP server, 338, 347SmtpClient class, 334SmtpException type, 689snippets, code, 62Solution Explorer, 18–19SortedAscendingCellStyle, 557SortedAscendingHeaderStyle, 557SortedDescendingCellStyle, 557SortedDescendingHeaderStyle, 557source, data, 455Source View, 48<span> element, 13Split View, 48, 64SQL (Structured Query Language)

for data management, 425for database access, 421text case, 429LINQ to SQL, 499

SQL pane, 433SQL Server

access rules, 762power of, 423providers, 606

SQL Server 2012data types, 441–442database files, 44power of, 423reading data with, 427–438sample database creation, 425–427support of ANSI 92 SQL standard, 425

SQL Server 2012 Express

bindex.indd 833bindex.indd 833 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

834

SQL statement – styling

installing, 5, 424LocalDB edition, 465

SQL statementin ASPX pages, 493in customized GridView columns, 474in data creation, 437for data display, 462data types, 440–441modifications, 572SelectCommand, 472subset of columns in, 477VS-generated, 470

SqlDataSource controlADO.NET under, 499collection from Review table, 470for data display, 457for data insertion, 464as data source control, 456data-bound control in conjunction with,

460–461for DetailsView customization, 490, 491DropDownList, 470similarity of EntityDataSource to,

517–518SqlDataSourceStatusEventArgs class, 575SqlRoleProvider, 607SqlMembershipProvider

SSMS (SQL Server Management Studio)in database work, 431installing, 424Table Designer, 446table error check in, 474

stack trace, 728stale data, 590Standard controls, 116–132Start Page, 20statements, 157–177static methods, 378, 379Static property, 296static text, 10

StaticEnableDefaultPopOutImage property, 261

StepType, 130String.Format method, 377strings

assigning, 148connection, 495query string parameters, 597returns by web service methods, 377setting empty, 471simple and complex, 378storing connection, 464–466types, 150–151

strong typing, 155, 506style attribute, 115Style Builder, 84, 87Style class, 555style sheets, 72–79

as ASP.NET file type, 42creating embedded and inline, 93–98external, embedded, and inline, 85–87moving inline to external, 100–102

<style> elementadded to <head> section, 70embedded, 85properties, 266writing CSS, 68–69

styles, 554–563, 602Styles folder, 79Styles.css file, 79, 88–92StyleSheetTheme property, 230, 234styling. see also CSS (cascading style sheets)

languageapplying CSS, 98–100external, embedded, and inline CSS,

85–87HTML limitations on, 66inline, 115managing CSS, 100–102Menu control, 265–269

bindex.indd 834bindex.indd 834 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

835

submit event – Text property

the Planet Wrox homepage, 79–85programmatic change of CSS, 407standard GridView control, 554TreeView control, 270user controls, 308

submit event, 413:submit filter, 403subroutines (subs), 177–179Substitute control, 131Sum operator, 509Summary column, 444synchronizing files, 744syntax

of $ method, 397CSS, 69, 397data-binding expression, 465, 495errors, 680expression, 731, 766jQuery, 395–396LINQ, 498, 506method syntax, 511SQL extensions, 425standard query operators, 507–511

System, 149–150System.IO namespace, 340System.Linq namespace, 499System.Net.Mail namespace, 334, 347System.Web.Profile namespace, 672System.Web.UI.WebControls namespace,

555

T

tab size, 26–27TabIndex property, 114Table Designer, 446Table menu, 58–60<table> element, 13TableDemo.aspx, 58, 61tables

active item tracking, 406creating, 440, 443–446database, 460defined, 452Entity Framework work with, 500Picture and PhotoAlbum, 523primary keys and identities, 442–443in relational databases, 422relationships between, 446–450, 452SQL Server data types, 441–442

tags, HTMLdefined, 32elements and, 11–14exceptions when controls look like,

332–333HTML5, 14

Take operator, 509TakeWhile operator, 509–510TemplateField, 473templates

creating reusable page, 225–229customizing ListView, 526, 538–544generics as, 156ListView control, 525LoginView control, 614master pages as, 208, 212New Web Site dialog, 35–37project, 64

temporary redirect, 277, 283terminology. see also syntax

OO, 189–201programming, 146

textfiles, 340–345markup, adding, 54–57

:text filter, 403Text property

vs. ErrorMessage property, 321Login control, 613in Markup View, 21

bindex.indd 835bindex.indd 835 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

836

text strings – types

validation control, 320text strings, 147TextBox control

adding a, 109–113bound, 491ControlToValidate property, 315ID and runat attribute, 109and maintenance of state, 135for profile use, 656Server Control markup, 114–115Toolbox, 21

text-decoration property, 89TextMode property, 317text/ntext data type, 442<textarea> element, 13Theme property, 230themes, 229–245

adding images to, 235–238applying, 230–231combined with styles, 559–563defined, 252dynamic switching of, 238–245error of invalid, 271extending, 235how to create, 229, 231–235skins, 245StyleSheetTheme or Theme property,

230and text readability, 265types of, 230

Tick event, 363time data type, 441Timer control, 362–363tinyint data type, 442tips, data, 701, 728title case search, 89Title column, 444, 491<title> element, 12titles, invalid page, 232, 597, 700toggle() effect, 409

toggleClass method, 404toolbars

create your own, 27customizing, 27editing, 27formatting, 57VSEW, 18

Toolboxdata-bound controls, 454–455HTML controls, 132–133modifications, 24, 25resetting, 28Standard controls, 116–132TextBox control, 21Timer control, 362–363

toolboxes, VSEW, 18ToolTip column, 519ToolTip property, 114trace, the, 718traceMode attribute, 720tracing

customizing, 723–724defined, 728entire website, 720–722function of, 718individual pages, 719–720and performance, 725security, 725stack trace, 728

TreeView control, 257, 270–274, 283Triggers property, 355true/false constructs (Boolean), 147Try block, 683Try Catch block, 688, 689T-SQL (Transact-SQL), 425type attribute, 646type inference, 506Type property, 322, 323Type selector, 73types

bindex.indd 836bindex.indd 836 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

837

uniform resource locator – validation

anonymous, 511–513, 552Common Type System (CTS), 149–150data. see data typesgenerics, 507, 648inference, 506, 512, 552project, 64safety in, 156strong, 506, 510, 536–538, 552

U

uniform resource locator (URL), 254uniqueidentifier data type, 442Universal selector, 73, 397unload phase, 220unobtrusive JavaScript validation,

414–418unordered lists, 60“Untitled Page”, 219UPDATE statement, 438, 440UpdateDateTime column, 445, 492, 586UpdateMode property, 355UpdatePanel control, 352, 358, 362, 383UpdateParameters, 460, 462, 491, 495UpdateProgress control, 358, 383updates

NuGet, 389package, 388

upper bounds, 153url attribute, 259URLs

absolute and relative, 254–257NavigateUrl property, 302query strings, 277routing to define, 281

user controls, 285–310added to content or master pages,

290–293adding properties/methods to, 296–297caveats, 295–296

creating, 287–290exercises with, 309function of, 285introduction to, 286practical tips for, 308registering, 290sitewide registration of, 293–294smart, 298–302summary of, 309

usernamesauthentication of, 604check for existing, 621

usersaccess rights, 603–604anonymous, 671–672applying theme selected by, 243–245data storage in a profile, 652–656flow of data from, 311identifying anonymous, 670–671input from, 311–347, 312, 313, 313–332,

334–345, 341–345management of photo albums, 665–670managing with WSAT, 628–632methods for gathering data from, 312personalized content for, 643photo uploads, 518profiles of non-current, 672–675programmatic redirection of, 276programmatic role checking of, 636–640providing feedback to, 358–362SiteMapPath control for, 257theme selection, 238, 239–243tracking details, 643

Using block, 504

V

ValidateRequest attribute, 333validation

bindex.indd 837bindex.indd 837 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

838

validation controls– ViewState collection

ASP.NET controls, 313client-side, 314of DetailsView control, 491exercises with, 346page, 220practical tips for, 345summary of, 346unobtrusive jQuery, 414–418of user input, 311–347

validation controlsCustomValidator and ValidationSummary, 327–332

defined, 347to extend a contact form, 323–326HTML vs. Standard, 133HTML5 data types, 317–320RangeValidator control, 321–322RequiredFieldValidator control, 315–317for Review instance, 588standard, 320–321unobtrusive JavaScript, 416usefulness of, 312writing client- and server-side methods,

327–332ValidationGroup property, 321ValidationSummary control, 313, 327–332Value attributes, 122values

assigning, 148boolean values, 513CSS, 71, 76–77server-side TextMode, 318setting empty strings, 471stored in View State, 308Table Designer default, 446

ValueToCompare property, 323varchar data type, 442variables

backing, 191copies of, 179

declaration of, 147generics typing of, 507inferring, 509naming, 202range, 508, 552strongly typed, 506

VB.NETaccess modifiers, 200arrays, 153attributes, 365caching with, 593cross-language communication, 149declaring variables in, 147LINQ, 498, 506methods, 178parameter lists, 179programming language, 50resources on, 146as strongly typed, 506Timer control, 363type casting, 152web application projects with, 38

VerticalAlign property, 556<video> element, 14Vieira, Robert, 436View State

caveats, 308control reconstruction, 569defined, 143function of, 138properties, 310property implementation, 302–308StepType, 130

ViewDetails.aspx page, 598views

different Web Forms, 47–49switching while writing CSS code,

69–70__VIEWSTATE field, 138–139, 140, 143ViewState collection, 310

bindex.indd 838bindex.indd 838 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

839

virtual paths – web server

virtual paths, 344VirtualFolder, 543Visible property, 114:visited selector, 92Visual Basic. see VB.NETVisual Studio

commercial vs. free version, 2–3, 6communication with Windows

platforms, 45configuring, 6CSS property lookup, 76English version, 504Express (VSEW), 3–5, 5, 17, 32Express 2012, 2, 3getting, 3GridView and DetailsView code, 472IDE tour, 16–20installing, 3–5markup aid for table insertion, 60.NET, 1post-customization restore of, 28practical tips for, 31previous versions, 2SQL statement generation, 470support for CSS, 65tag generation, 14Team blog, 7412012, 17, 32, 34web service creation, 369working with CSS in, 87–102

Visual Web Developer 2008, 65

W

Warn method, 724Watch window, 703, 708Watching Variables window, 702–703Web Application Project, 34, 38, 645, 741web applications

ASP.NET 4.5, 606

configuring, 334–336, 624–627creating websites, 5–9data caching options, 590–594enabling Profile in, 644EntityDataSource control, 518–524file mapping onto, 10functions and subroutines to organize, 83with Microsoft VS, 2page display process, 9Planet Wrox as sample, 28–30pre-compiling, 745, 766ready for release, 729reconfigured for remove server, 762vs. website projects, 35work with roles, 632–636

Web Configuration File, 42web files, 41Web Forms

with code, adding to a site, 49–54Code Behind vs. inline, 62CodeInline.aspx, 52defined, 42, 64different views, 47–49for jQuery library addition, 393site, 39TableDemo.aspx, 58as template option, 36“Untitled Page” default, 219user input into, 334–340validating user input in web,

313–332Web Forms Site, 386Web Packaging, 741Web Platform Installer, 5, 747web server

browser requests to, 10commenting out code at, 14data processing, 334–345, 347for displaying Default.aspx, 9error troubleshooting, 757–759

bindex.indd 839bindex.indd 839 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

840

web services – Where clause

flow of data from, 311HTTP as stateless, 134image re-sizing, 549installing/configuring, 746interaction with the browser, 350opening sites via, 39page events firing at, 220postback, 21–22publishing to a, 729reading of content page, 215SQL Server, 465

web services, 363–378ASP.NET 4.5, 606calling from client-side code, 365–366,

373–378creating, 369–378defined, 383similarity of WCF service to, 36WCF, 364–365

Web Site ProjectsApp_Code folder, 180model for learning, 741Profile service work with, 645as VS type, 34

Web Site (Razor v1/Razor v2), 36Web User Control, 42Web.config file

configuration information, 627defining Profile properties in, 650in e-mail message creation, 338enabling custom errors in, 696Management folder, 462moving application settings to, 733–737moving hard-code settings to, 733–737readying for publication, 731registering user controls in, 293–294storing connection strings in, 464–466tracking details in, 644in web services, 375in website file additions, 43

WebConfigurationManager class, 732–733, 766

WebParts controls, 134Webservices.aspx, 379Web.sitemap file

adding a Menu control to, 262for controls, 258–260defined, 283

websites, 207–252adding a menu to, 262ASP.NET 4.5, 606bundling/minification for performance,

738–740configuring, 749–753copying, 741–745creating, 5–9, 33, 37–39deployment checklist, 763–764deployment preparations, 730–737diagnostics with Page Inspector,

713–718e-mail sent from, 334–340global exception handling, 691importance of databases to, 421linking pages within, 60–62logical structure of, 258Management section, 457master pages for updating, 215moved to remove server, 760opening existing, 39–40organization, 46–47personalized content for, 643Planet Wrox sample, 28–30projects, 34publishing, 745registering user controls on, 293–294site-level themes, 231templates, 35–37tracing, 720–722user access to, 603–604

Where clause (LINQ), 509, 533

bindex.indd 840bindex.indd 840 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM

841

WHERE clause – zip fi les

WHERE clause (SQL)for filtering data, 466to limit item display, 470–471as operator, 429, 509Query Designer, 434

Where property, 518WhereParameters collection, 533While loop, 175widgets, 418Width property, 114, 556windows

ASP.NET informational, 22–23debugging, 702–705rearranging, 23resetting layout of, 28syncing relevant, 99

Windows Communication Foundation (WCF)

calling from client-side code, 375creating a web service, 369–372exchanging complex objects with,

366–369files, 43web services, 36, 364–365

Windows network, 45Wizard control, 123World Wide Web Consortium (W3C), 68Wrap property, 556

Write method, 724WriteAllText method, 340WriteMessage method, 568write-only properties, 193writing comments, 186–188, 203WSAT, 628–632

X

XML control, 132XML files

and asynchronous JavaScript, 349as data file, 44vs. JSON, 371LINQ to, 499Web.sitemap file, 258writing comments for, 187–188

Y

Yellow Screen of Death, 579, 682, 696York, Richard, 87

Z

Zakas, Nicholas C., 327zero-based arrays, 153zip files, 228

bindex.indd 841bindex.indd 841 10/4/2012 9:56:34 PM10/4/2012 9:56:34 PM