Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Visual Web Developer™ 2005 Express Edition For Dummies - Alan Simpson

.pdf
Скачиваний:
22
Добавлен:
24.05.2014
Размер:
12.36 Mб
Скачать

Publisher’s Acknowledgments

We’re proud of this book; please send us your comments through our online registration form located at www.dummies.com/register/.

Some of the people who helped bring this book to market include the following:

Acquisitions, Editorial, and

Composition Services

Media Development

Project Coordinator: Adrienne Martinez

Project Editor: Christopher Morris

Layout and Graphics: Carl Byers, Andrea Dahl,

Acquisitions Editor: Katie Feltman

Lauren Goddard, Barbara Moore,

Senior Copy Editor: Barry Childs-Helton

Barry Offringa

Proofreaders: Laura Albert, Dwight Ramsey,

Technical Editor: Dan DiNicolo

TECHBOOKS Production Services

Editorial Manager: Kevin Kirschner

Indexer: Sherry Massey

Media Development Manager:

 

Laura VanWinkle

 

Media Development Supervisor:

 

Richard Graves

 

Editorial Assistant: Amanda Foxworth

 

Cartoons: Rich Tennant

 

(www.the5thwave.com)

 

 

 

Publishing and Editorial for Technology Dummies

Richard Swadley, Vice President and Executive Group Publisher

Andy Cummings, Vice President and Publisher

Mary Bednarek, Executive Acquisitions Director

Mary C. Corder, Editorial Director

Publishing for Consumer Dummies

Diane Graves Steele, Vice President and Publisher

Joyce Pepple, Acquisitions Director

Composition Services

Gerry Fahey, Vice President of Production Services

Debbie Stailey, Director of Composition Services

Contents at a Glance

Introduction ................................................................

1

Part I: Planning a Web Site ..........................................

7

Chapter 1: Getting Started ................................................................................................

9

Chapter 2: Creating a Web Site ......................................................................................

21

Chapter 3: Configuring a Membership Site ..................................................................

39

Chapter 4: Creating Master Pages .................................................................................

53

Part II: Building Your Web Site ..................................

73

Chapter 5: Creating Web Pages ......................................................................................

75

Chapter 6: Designing with Styles ...................................................................................

97

Chapter 7: Working with ASP.NET Controls ...............................................................

123

Chapter 8: Easy Site Navigation ...................................................................................

153

Part III: Personalization and Databases .....................

169

Chapter 9: Using Personalization ................................................................................

171

Chapter 10: Using Themes ...........................................................................................

199

Chapter 11: SQL Server Crash Course ........................................................................

221

Chapter 12: Using Data in Web Pages .........................................................................

261

Part IV: The Part of Tens ..........................................

319

Chapter 13: Ten Terms to Make You Look Smart ......................................................

321

Chapter 14: Ten Alternatives to Being Helpless ........................................................

327

Appendix: Publishing Your Site .................................

331

What’s on the CD-ROM? ...........................................

337

Index ......................................................................

341

End-User License Agreement .......................

Back of Book

Table of Contents

 

Introduction ..................................................................

1

About This Book ...............................................................................................

2

Foolish Assumptions ........................................................................................

2

Conventions Used in This Book .....................................................................

3

What You’re Not to Read .................................................................................

3

How This Book Is Organized ...........................................................................

4

Part I: Planning a Web Site .....................................................................

4

Part II: Building Your Web Site ..............................................................

4

Part III: Personalization and Databases ...............................................

4

Part IV: The Part of Tens ........................................................................

4

Icons Used in This Book ..................................................................................

5

Where to Go from Here ....................................................................................

5

Part I: Planning a Web Site ...........................................

7

Chapter 1: Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

.9

Who VWD Is For ................................................................................................

9

Installing Visual Web Developer ...................................................................

10

Getting Around in VWD .................................................................................

10

Using panes ...........................................................................................

11

Getting panes back to normal .............................................................

12

Don’t forget the View menu .................................................................

13

About the Start Page ......................................................................................

14

Using VWD Help ..............................................................................................

14

Closing Help pages and panes ............................................................

16

Online resources ...................................................................................

16

Being Compatible with Web Browsers ........................................................

17

Publishing Your Web Site ..............................................................................

19

Chapter 2: Creating a Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

Creating a Web Site ........................................................................................

21

Closing and Opening Pages ...........................................................................

23

Creating and Using Folders ...........................................................................

24

Copying files to folders ........................................................................

25

Renaming and deleting folders ...........................................................

26

xiv

Visual Web Developer 2005 Express Edition For Dummies

 

 

Editing Pages ...................................................................................................

26

 

Adding text to a page ...........................................................................

27

 

Selecting and formatting text ..............................................................

27

 

Undoing changes ..................................................................................

28

 

Adding pictures .....................................................................................

28

 

Changing properties .............................................................................

29

 

Switching views ....................................................................................

30

 

Editing in Source view ..........................................................................

31

 

Saving your work ..................................................................................

32

 

Dealing with code-behind files ............................................................

33

 

Titling Pages ....................................................................................................

34

 

Viewing Pages in a Web Browser ..................................................................

35

 

Opening and Closing Web Sites ....................................................................

37

 

Chapter 3: Configuring a Membership Site . . . . . . . . . . . . . . . . . . . . . .

.39

 

Creating a Folder for Members-Only Content .............................................

39

 

Using the Web Site Administration Tool ......................................................

40

 

Choosing an authentication type .......................................................

42

 

Creating Roles to Categorize People ............................................................

43

 

Creating Access Rules ....................................................................................

45

 

Managing access rules .........................................................................

46

 

Creating a User Account ................................................................................

48

 

Managing user accounts ......................................................................

50

 

Closing the Web Site Administration tool ..........................................

51

 

What the Web Site Administration Tool Did ...............................................

51

 

Chapter 4: Creating Master Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

.53

 

Creating a Folder for Master Pages ..............................................................

54

 

Creating a Master Page ..................................................................................

54

 

Designing your page layout .................................................................

55

 

Styling Master Page panes ...................................................................

57

 

Styling the left pane ..............................................................................

60

 

Styling the ContentPlaceHolder pane ................................................

61

 

Using a Master Page .......................................................................................

63

 

Editing a Master Page ....................................................................................

66

 

Adding a Master Page to Existing Pages ......................................................

69

 

Part II: Building Your Web Site ....................................

73

 

Chapter 5: Creating Web Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

.75

 

Creating a New Blank Page ............................................................................

75

 

Creating HTML Tables ...................................................................................

77

 

Adding a table to a page ......................................................................

77

 

Typing in table cells .............................................................................

78

 

Table of Contents

xv

 

Working with HTML Tables ...........................................................................

78

 

Selecting rows and columns ................................................................

79

 

Selecting cells ........................................................................................

80

 

Merging cells .........................................................................................

80

 

Styling cells ............................................................................................

81

 

Adding controls to table cells .............................................................

84

 

Adding Hyperlinks to Pages ..........................................................................

84

 

Quick links to pages in your site ........................................................

85

 

Creating bookmarks .............................................................................

86

 

Linking to bookmarks ..........................................................................

86

 

Adding and Styling Pictures ..........................................................................

87

 

Sizing a picture ......................................................................................

88

 

Styling pictures .....................................................................................

88

 

Adding Lines ...................................................................................................

92

 

Editing in Source View ...................................................................................

92

 

Selecting in Source view ......................................................................

93

 

Typing tags and attributes ..................................................................

93

 

Debugging HTML ..................................................................................

95

 

Chapter 6: Designing with Styles . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . .97

 

Understanding CSS .........................................................................................

97

 

Creating a CSS Style Sheet ...........................................................................

100

 

Creating Style Rules .....................................................................................

101

 

Creating CSS element styles ..............................................................

101

 

Creating CSS class selectors .............................................................

102

 

Defining Rules with Style Builder ...............................................................

104

 

Styling fonts .........................................................................................

105

 

Styling the background ......................................................................

107

 

Styling text alignment and spacing ..................................................

108

 

Styling position ...................................................................................

110

 

Styling layout .......................................................................................

112

 

Styling boxes and borders .................................................................

113

 

Saving Style Builder choices .............................................................

114

 

Saving a CSS style sheet .....................................................................

115

 

Linking to a Style Sheet ................................................................................

115

 

Using Styles in a Page ..................................................................................

116

 

Applying CSS element selectors .......................................................

116

 

Applying CSS class selectors .............................................................

117

 

Applying element class selectors .....................................................

119

 

Using DIV styles ..................................................................................

120

 

The CSS 2.1 Specification ............................................................................

122

 

Chapter 7: Working with ASP.NET Controls . . . . . . . .

. . . . . . . . . . . . .123

 

What Is ASP.NET? ..........................................................................................

123

 

Adding a Server Control to a Page .............................................................

125

 

Tweaking server controls in Design view ........................................

126

 

Using the Common Tasks menu ........................................................

127

 

xvi

Visual Web Developer 2005 Express Edition For Dummies

 

 

ASP.NET Login Controls ...............................................................................

130

 

Allowing Users to Create an Account ........................................................

131

 

Assigning new users to a role ...........................................................

133

 

Testing the control .............................................................................

134

 

Creating a Login Page ..................................................................................

135

 

Providing a Login Link .................................................................................

136

 

The LoginStatus control ....................................................................

137

 

The LoginName control .....................................................................

138

 

The LoginView control .......................................................................

138

 

Letting Users Manage Passwords ...............................................................

141

 

Using the PasswordRecovery control ..............................................

141

 

The ChangePassword control ...........................................................

145

 

Testing Membership ....................................................................................

146

 

Server Controls in Source View ..................................................................

148

 

Relaxing Password Constraints ..................................................................

149

 

Chapter 8: Easy Site Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. .153

 

Getting Organized .........................................................................................

153

 

Using Site-Navigation Controls ...................................................................

154

 

Using the TreeView and Menu Controls ....................................................

155

 

Creating a Site Map ......................................................................................

158

 

Customizing navigation for roles ......................................................

161

 

Binding a control to Web.sitemap ....................................................

163

 

Adding an Eyebrow Menu ...........................................................................

164

 

Creating Web User Controls ........................................................................

165

 

Creating a Web User Control .............................................................

166

 

Using a Web User Control ..................................................................

167

 

Part III: Personalization and Databases ......................

169

 

Chapter 9: Using Personalization . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. .171

 

Creating a User Profile .................................................................................

171

 

Setting up user profiles ......................................................................

173

 

Letting Users Enter Properties ...................................................................

176

 

Adding a button ..................................................................................

178

 

Writing some code ..............................................................................

179

 

Tying code to an event .......................................................................

180

 

Determining where to put the profile information .........................

183

 

Letting users edit their profiles ........................................................

184

 

Using profile properties with Visual Basic ......................................

187

 

Using Validation Controls ............................................................................

188

 

RequiredFieldValidator ......................................................................

189

 

RangeValidator ....................................................................................

190

 

Table of Contents

xvii

 

RegularExpressionValidator ..............................................................

190

 

CompareValidator ...............................................................................

191

 

CustomValidator .................................................................................

192

 

ValidationSummary ............................................................................

192

 

Using the Forms Designer ...........................................................................

193

 

Stacking absolutely-positioned objects ...........................................

194

 

Aligning absolutely-positioned objects ...........................................

195

 

Sizing objects equally .........................................................................

196

 

Spacing absolutely-positioned objects ............................................

197

 

Chapter 10: Using Themes . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . .199

 

Creating Themes ...........................................................................................

199

 

Creating Theme Folders ..............................................................................

200

 

What’s in a Theme? ......................................................................................

201

 

Using Pictures in Themes ............................................................................

201

 

Creating a Theme Style Sheet .....................................................................

202

 

Creating Skins ...............................................................................................

204

 

Creating a skin file ..............................................................................

204

 

Default vs. named skins .....................................................................

207

 

Using Themes in Pages ................................................................................

209

 

Letting Members Choose a Theme ............................................................

210

 

Creating a page for viewing themes .................................................

211

 

Creating a control for choosing a theme .........................................

212

 

Storing the preferred theme ..............................................................

213

 

Applying a theme ................................................................................

214

 

A theme tester page ...........................................................................

216

 

Applying Themes to Master Pages .............................................................

217

 

Other Ways to Apply Themes .....................................................................

218

 

Defining a Site-Wide Default Theme ...........................................................

219

 

Chapter 11: SQL Server Crash Course . . . . . . . . . . . . .

. . . . . . . . . . . . .221

 

Crash Course in Database Design ..............................................................

222

 

Tables, rows, and columns ................................................................

222

 

One-to-many, many-to-many ..............................................................

223

 

SQL Server Tables ...............................................................................

227

 

Assigning GUIDs automatically .........................................................

233

 

Creating Your Own Tables ...........................................................................

236

 

Defining a primary key .......................................................................

237

 

Creating text fields .............................................................................

238

 

Adding a money field .........................................................................

240

 

Saving the new table ..........................................................................

240

 

Creating the Transactions table .......................................................

241

 

A Primary Key for Transactions .......................................................

243

 

Populating Tables .........................................................................................

244

 

xviii Visual Web Developer 2005 Express Edition For Dummies

 

Linking Tables ...............................................................................................

247

Creating a view ....................................................................................

248

A more detailed view ..........................................................................

251

Creating a Table of Pictures ........................................................................

254

Creating a Table of HyperLinks ..................................................................

257

Chapter 12: Using Data in Web Pages . . . . . . . . . . . . . . . . . . . . . . . .

. .261

Binding Data to Controls .............................................................................

262

Using the Data Configuration Wizard ...............................................

262

Data controls in Design view .............................................................

273

Formatting Dates and Numbers ..................................................................

274

Some Security Considerations ....................................................................

275

Using the GridView Control ........................................................................

276

An instant GridView control ..............................................................

276

Formatting the GridView control ......................................................

278

Binding to DropDownList Controls ............................................................

280

Using a DropDownList to filter records ...........................................

282

Viewing and editing user properties ................................................

284

Using the DetailsView Control ....................................................................

287

Binding a DetailsView control ...........................................................

287

Formatting a DetailsView control .....................................................

289

Creating Master-Details Forms ...................................................................

291

Master-Details DropDownList control .............................................

292

Master-Details GridView control ......................................................

293

The Master-Details DetailsView control ..........................................

294

General GridView and DetailsView considerations ........................

295

Using the DataList Control ..........................................................................

296

Formatting a DataList control ...........................................................

298

Formatting dates and numbers in a DataList ..................................

300

Showing a DataList in columns .........................................................

301

Using DataList to show pictures .......................................................

302

Using a DataList to show HyperLinks ..............................................

309

The FormView Control .................................................................................

312

Showing subtotals ..............................................................................

314

Part IV: The Part of Tens ............................................

319

Chapter 13: Ten Terms to Make You Look Smart . . . . . . . . . . . . . . .

. .321

Web Application ...........................................................................................

321

Developer ......................................................................................................

321

Data-Driven ....................................................................................................

322

ASP.NET 2.0 ...................................................................................................

322

Visual Studio .................................................................................................

322

IDE ..................................................................................................................

322

 

Table of Contents

xix

 

Control ...........................................................................................................

323

 

Code ...............................................................................................................

323

 

Programmatic ...............................................................................................

324

 

Database ........................................................................................................

325

 

Chapter 14: Ten Alternatives to Being Helpless . . . . .

. . . . . . . . . . . . .327

 

Microsoft Developer Network (MSDN) ......................................................

327

 

HTML Home Page .........................................................................................

327

 

Cascading Style Sheets Home Page ............................................................

328

 

XML Home Page ............................................................................................

328

 

ASP.NET .........................................................................................................

328

 

ASP.NET Starter Kits ....................................................................................

328

 

ASP.NET Forums ...........................................................................................

329

 

SQL Server Developer Center .....................................................................

329

 

dotnetjunkies ................................................................................................

329

 

Microsoft Technical Communities .............................................................

329

 

Appendix: Publishing Your Site ...................................

331

 

Choosing a Hosting Provider ......................................................................

331

 

Preparing Your Site for Uploading ..............................................................

332

 

Copying the Site ............................................................................................

334

 

What’s on the CD-ROM? ...........................................

337

 

Visual Basic 2005 Express ...........................................................................

337

 

Visual Web Developer 2005 Express ..........................................................

338

 

Index .......................................................................

341

 

End-User License Agreement ........................

Back of Book

 

Соседние файлы в предмете Информатика