Build Your Own ASP.NET 3.5 Website Using C# & VB (116 page)

Read Build Your Own ASP.NET 3.5 Website Using C# & VB Online

Authors: Cristian Darie,Zak Ruvalcaba,Wyatt Barnett

Tags: #C♯ (Computer program language), #Active server pages, #Programming Languages, #C#, #Web Page Design, #Computers, #Web site development, #internet programming, #General, #C? (Computer program language), #Internet, #Visual BASIC, #Microsoft Visual BASIC, #Application Development, #Microsoft .NET Framework

BOOK: Build Your Own ASP.NET 3.5 Website Using C# & VB
13.87Mb size Format: txt, pdf, ePub

a TreeNodeCollection containing the root nodes of the tree

NodeStyle

the TreeNodeStyle object that defines the default appearance of all tree nodes

NodeWrap

a Boolean value indicating whether the text in a node wraps

NoExpandImageUrl

a string representing the URL for a custom image that indicates nodes that cannot

be expanded

ParentNodeStyle

the TreeNodeStyle object that defines the appearance of parent nodes

PathSeparator

the character used to delimit node values in the ValuePath property

PopulateNodesFromClient

a Boolean value that specifies whether or not node data should be populated

dynamically when necessary, without posting back to the server; default value

is True

RootNodeStyle

a TreeNodeStyle object that defines the appearance of the root node

Licensed to [email protected]

Appendix A: Web Control Reference

693

SelectedNode

a string containing the value of the selected node

SelectedNodeStyle

a TreeNodeStyle object that defines the appearance of the selected node

ShowCheckBoxes

a TreeNodeTypes value that defines which tree nodes should be associated with

text boxes; possible values are All, Leaf, None, Parent, and Root

ShowExpandCollapse

a Boolean value that determines whether or not expansion node indicators

should be displayed

ShowLines

a Boolean value that determines whether or not linking lines between parent

nodes and child nodes should be displayed

SkipLinkText

a string that describes the link that allows screen reader users to skip the content

of this element

Target

specifies the target window or frame in which content associated with a menu

item should be displayed when that item is clicked; possible values are _blank,

_parent, _search, _self, and _top

Methods

CollapseAll

collapses all nodes

DataBind

binds the control to its data source

ExpandAll

expands all nodes

FindNode

returns the TreeNode object located at the path specified

by the string parameter

Events

SelectedNodeChanged

fires when the currently selected item changes

Licensed to [email protected]

694

Build Your Own ASP.NET 3.5 Web Site Using C# & VB

TreeNodeCheckChanged

fires when a checkbox changes state

TreeNodeCollapsed

fires when a node is collapsed

TreeNodeExpanded

fires when a node is expanded

TreeNodePopulate

fires when a node that has its PopulateOnDemand property

set to True is expanded

Ajax Web Extensions

ScriptManager

Properties

AllowCustomErrorsRedirect

specifies whether or not the custom errors section of the
Web.config
file is used

in the case of an error occurring during an asynchronous postback request

AsyncPostBackErrorMessage

specifies the error message that’s sent to the client browser when an unhandled

error occurs during an asynchronous postback request

AsyncPostBackSourceElementID

specifies the ID of the control that initiated the asynchronous postback request

AsyncPostBackTimeout

specifies the time-out period in seconds for asynchronous postback requests

EnablePartialRendering

if set to True, allows the use of UpdatePanel controls to implement partial page

updates

LoadScriptsBeforeUI

specifies if scripts are loaded before or after the page markup is loaded

ScriptPath

sets the root path of the location of ASP.NET AJAX or custom script files

Licensed to [email protected]

Appendix A: Web Control Reference

695

Events

AsyncPostBackError

raised when an error occurs during an asynchronous

postback request

Timer

Properties

Enabled

specifies if the Timer is active

Interval

specifies the length of the delay in milliseconds before a

postback request will be initiated

UpdatePanel

Properties

ChildrenAsTriggers

specifies whether immediate child controls of the UpdatePanel can trigger an

update of the panel

ContentTemplate

the template that defines the content of the panel

ContentTemplateContainer

a control object to which you can add child controls

Controls

a ControlCollection object containing the child controls for the UpdatePanel

IsInPartialRendering

indicates the UpdatePanel is currently being updated by an asynchronous

postback request

RenderMode

specifies whether the UpdatePanel will be rendered as an HTML div (if set to

Block) or span (if set to Inline) element

Licensed to [email protected]

696

Build Your Own ASP.NET 3.5 Web Site Using C# & VB

Triggers

an UpdatePanelTriggerCollection object containing all the registered triggers

for the UpdatePanel

UpdateMode

specifies when the contents of the UpdatePanel are updated; possible values

are Always or Conditional

Methods

Update

causes an update of the contents of the UpdatePanel

UpdateProgress

Properties

AssociatedUpdatePanelID

specifies the ID of the associated UpdatePanel

DisplayAfter

specifies the amount of time in milliseconds before the UpdateProgress control

is displayed

DynamicLayout

specifies if the control is rendered dynamically

ProgressTemplate

the template that defines the content of the UpdateProgress control

Licensed to [email protected]

Appendix B: Deploying ASP.NET Web Sites

One of the trickier parts of working with ASP.NET is deploying your application.

Firstly, unlike many traditional scripting languages such as PHP or classic ASP,

ASP.NET is compiled. Second, SQL Server databases are not as easily transportable

as other database like MySQL, for example, that many developers grew up with.

Third, the complex nature of the framework may lead to many cases where things

that work in development on your local machine fail on your remote web server,

where you don’t have nearly as many tools available to debug the issues.

But don’t be intimidated—it’s still possible to deploy ASP.NET applications quite

easily using Visual Web Developer Express and the SQL Server Hosting Toolkit.

ASP.NET Hosting Considerations

Before worrying about how to deploy our applications we should find a web host.

Feel free to skip this section if you already have a host that you’re satisfied with; if

not, read on for some handy tips on how to choose a host. Given the bewildering

array of ASP.NET hosting options available these days, you might find it helpful to

remember these key points while you shop:

1. You are first and foremost choosing a service provider. If you can’t get sales to

answer questions very quickly, don’t delude yourself that the service department

will be any better; it won’t. Trust me, you
will
need to use the service department

at some point.

2. Making the decision solely on the basis of price is pure folly. Yes, you could save

$2 a month or so with the cheapest options, but you generally get what you pay

for in this world. Web hosting is a very low-margin business these days, and

bargain-basement hosting is almost a no-margin business. Remember, your hosting

fees are not dead money; they’re paying for the equipment your site is running

on and the engineers looking after that equipment.

3. Choose a service that has an upgrade path of some sort. It should offer semidedicated hosting, virtual private servers and/or dedicated boxes along with runof-the-mill shared hosting. Licensed to [email protected]

698

Build Your Own ASP.NET 3.5 Web Site Using C# & VB

4. Make sure the host supports the version of the framework you’re using in development. You may be surprised that at the time of writing, there are still some less reputable hosts that don’t support ASP.NET 3.5 or even ASP.NET AJAX on

.NET 2.0, both of which have long been released to manufacturing with Microsoft’s

full support. Also make certain the host provides the sort of database server you

wish to use in your project.

5. Peruse the host’s online troubleshooting documentation. First, be very wary if

you can’t find any documentation at all. But, if it exists, walk through some typical scenarios—such as deploying a database—to see if there’s any guidance and if the guidance that’s there is clear and intelligible. Good documentation is generally indicative of a well-run operation that has the resources to create such documentation, rather than a fly-by-night shop with limited resources.

6. If at all possible, choose a Windows Server 2008-based host. Windows Server

2008 has a new version of IIS with many features that are designed to make

working with a remotely hosted ASP.NET web site much, much easier. The early

adoption of new technology by a host usually indicates that it’s better funded

and has access to a larger skill base than the guys milking yet another year out

of old equipment and operating systems.

7. Definitely visit online communities, such as the
hosting section of SitePoint for-

ums,1
to ask any questions before you reach for the plastic.
Using Visual Web Developer Express

to Deploy ASP.NET Applications

The principal tool that Visual Web Developer Express offers to help you deploy

your web site is the
Copy Website
feature. It can be found through the
Solution Explorer
(it’s the second button from the left) or via the
Website
menu’s
Copy Website…
item. The deployment tools also support the deployment of the file system, a local IIS

instance, a remote IIS instance using Front Page Server extensions, and/or a remote

server via FTP. You’ll probably use the FTP option to deploy your site, but we’re

going to use the local file system functionality in our example. This isn’t to say that

1 http://www.sitepoint.com/forums/forumdisplay.php?f=95

Licensed to [email protected]

Appendix B: Deploying ASP.NET Web Sites

699

you can’t use your favorite FTP client to push your files to your site, but Visual Web

Developer Express’s tool has a few advantages that we’ll explore below.

The time has come! Fire up Visual Web Developer Express, open your Dorknozzle

project, and let’s get started:

1.

Click on the
Website
menu and select
Copy Website…
to open the web site copy

tool.

2.

Click on the
Connect
button and leave
File System
selected. It’s here that, when transferring your web site to a remote host, you’d choose
FTP
and configure the

connection using the credentials provided by your host or your network administrator. For now, we’ll practice the process using the local file system. 3.

Select a folder to deploy to. Since we’re just practicing, and we’ll remove it

later, let’s create a temporary folder for the time being. Type
C:\DorknozzleTemp

into the
Folder
field and click
Open
. Click
Yes
when prompted, to create the folder. Y
our screen should now look like Figure B.1
.

Figure B.1. Opening the remote web site

Licensed to [email protected]

700

Build Your Own ASP.NET 3.5 Web Site Using C# & VB

4.

Select all the files in your
Source Web Site
panel and click on the double arrow

button to synchronize all selected files. There should now be an identical list

in both panes of the display.

Congratulations—you have just deployed the site with Visual Web Developer Express!

If you know anything about web sites, you’ll realize that changes and updates occur

often and the challenge is keeping the live web site synchronized and up to date.

This is exactly where the
Copy Website
tool shines. Let’s update the home page to

Other books

Zombies in Love by Fleischer, Nora
B00AO57VOY EBOK by Myers, AJ
Just Breathe by Allen, Heather
Will & Patrick Fight Their Feelings (#4) by Leta Blake, Alice Griffiths
The Third Scroll by Dana Marton
Hells Royalty The Princess by Wennberg, Jessica