Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
NET
Microsoft .NET is Microsoft's new Internet strategy. .NET was originally called NGWS.
Microsoft. NET
The Microsoft. NET strateg' was presented "' Microsoft officials to the rest of the world in &une ()))*
is Microsoft's new nternet and We" strateg' is N0T a new operating s'stem is a new nternet and We" "ased infrastructure deli$ers software as We" Ser$ices is a framewor, for uni$ersal ser$ices is a ser$er centric computing model will run in an' "rowser on an' platform is "ased on the newest We" standards
1TT2, the communication protocol "etween nternet 3pplications .M/, the format for e#changing data "etween nternet 3pplications S032, the standard format for re%uesting We" Ser$ices 4++ , the standard to search and disco$er We" Ser$ices
.NET Fra
ewor!
The .NET 5ramewor, is the infrastructure for the new Microsoft .NET 2latform. The .NET 5ramewor, is a common en$ironment for "uilding, deplo'ing, and
running We" Ser$ices and We" 3pplications. The .NET 5ramewor, contains common class li"raries ! li,e 3+0.NET, 3S2.NET and Windows 5orms ! to pro$ide ad$anced standard ser$ices that can "e integrated into a $ariet' of computer s'stems. The .NET 5ramewor, is language neutral. 6urrentl' it supports 677, 68, 9isual Basic, &Script :The Microsoft $ersion of &a$aScript; and 60B0/. Third! part' languages ! li,e Eiffel, 2erl, 2'thon, Smalltal,, and others ! will also "e a$aila"le for "uilding future .NET 5ramewor, applications. The new 9isual Studio.NET is a common de$elopment en$ironment for the new .NET 5ramewor,. t pro$ides a feature!rich application e#ecution en$ironment, simplified de$elopment and eas' integration "etween a num"er of different de$elopment languages.
"dditional Infor
ation
The .NET plan includes a new $ersion of the Windows operating s'stem, a new $ersion of 0ffice, and a $ariet' of new de$elopment software for programmers to "uild We"!"ased applications. The "ac,ground for .NET is part of Microsoft's new strateg' to ,eep Windows the dominant operating s'stem in the mar,et, as computing "egins to mo$e awa' from des,top computers toward nternet ena"led de$ices, such as hand!held computers and cell phones. The most $isual components of the new .NET framewor, are the new nternet nformation Ser$er <.), with 3S2.NET and 3+0.NET support, 9isual Studio.NET software tools to "uild We"!"ased software, and new .M/ support in the S=/ Ser$er ())) data"ase. Bill Gates is super$ising the .NET pro>ect.
We$ Services
We" Ser$ices pro$ide data and ser$ices to other applications. 5uture applications will access We" Ser$ices $ia standard We" 5ormats :1TT2, 1TM/, .M/, and S032;, with no need to ,now how the We" Ser$ice itself is implemented. We" Ser$ices are main "uilding "loc,s in the Microsoft .NET programming model.
Standard %o
unication
0fficial We" standards :.M/, 4++ , S032; will "e used to descri"e what nternet data is, and to descri"e what We" Ser$ices can do. 5uture We" applications will "e "uilt on fle#i"le ser$ices that can interact and e#change data, without the loss of integrit'.
Internet Storages
.NET offers secure and addressa"le places to store data and applications on the We". 3llowing all t'pes of nternet de$ices :26s, 2almtops, 2hones; to access data and applications. These We" Ser$ices are "uilt on Microsoft's e#isting NT5S, S=/ Ser$er, and E#change technologies.
Internet &yna
ic &elivery
?elia"le automatic upgrades "' demand and installation independent applications. .NET will support rapid de$elopment of applications that can "e d'namicall' reconfigured.
Internet Identity
.NET supports man' different le$els of authentication ser$ices li,e passwords, wallets, and smart cards. These ser$ices are "uilt on e#isting Microsoft 2assport and Windows 3uthentication technologies.
Internet Messaging
.NET supports integration of messaging, e!mail, $oice!mail, and fa# into one unified nternet Ser$ice, targeted for all ,inds of 26s or smart nternet de$ices. These ser$ices are "uilt on e#isting 1otmail, E#change and nstant Messenger technologies.
Internet %alendar
.NET supports nternet integration of wor,, social, and pri$ate home calendars. 3llowing all t'pes of nternet de$ices :26s, 2almtops, 2hones; to access the data. These ser$ices are "uilt on e#isting 0utloo, and 1otmail technologies.
NET Software
.NET is a
ent tools
Windows .NET
Toda', Windows ())) and Windows .2 form the "ac,"one of .NET. n the future, the .NET infrastructure will "e integrated into all Microsoft's operating s'stems, des,top and ser$er products. Windows .NET is the ne#t generation Windows. t will pro$ide support for all the .NET "uilding "loc,s and .NET digital media. Windows .NET will "e self!supporting with updates $ia nternet as users need them.
*ffice .NET
3 new $ersion of Microsoft 0ffice ! 0ffice .NET ! will ha$e a new .NET architecture "ased on nternet clients and We" Ser$ices. With 0ffice .NET, "rowsing, communication, document handling and authoring will "e integrated within a .M/!"ased en$ironment which allow users to store their documents on the nternet.
New /anguage Support 2rogramma"le 6ontrols E$ent +ri$en 2rogramming .M/ Based 6omponents 4ser 3uthentication 4ser 3ccounts and ?oles 1igh Scala"ilit' 6ompiled 6ode Eas' 6onfiguration Eas' +eplo'ment Not 3S2 6ompati"le ncludes 3+0 .NET
@ou can read more a"out 3S2 .NET and 3+0 .NET in our 3S2 .NET Tutorial.
The latest $ersion of 9isual Studio ! 9isual Studio .NET ! incorporates 3S2 .NET, 3+0 .NET, We" Ser$ices, We" 5orms, and language inno$ations for 9isual Basic. The de$elopment tools ha$e deep .M/ support, an .M/!"ased programming model and new o">ect!oriented programming capa"ilities.
Internet Infor
S <.) has strong support for more programming to ta,e place on the ser$er, to allow the new We" 3pplications to run in an' "rowser on an' platform
ited tas!.
We" ser$ices are small units of code designed to handle a limited set of tas,s. 3n e#ample of a we" ser$ice can "e a small program designed to suppl' other applications with the latest stoc, e#change prices. 3nother e#ample can "e a small program designed to handle credit card pa'ment.
We" ser$ices use the standard we" protocols 1TT2, .M/, S032, WS+/, and 4++ .
HTTP
1TT2 :1'perte#t Transfer 2rotocol; is the World Wide We" standard for communication o$er the nternet. 1TT2 is standardiAed "' the World Wide We" 6onsortium :WB6;.
XML
.M/ :e.tensi"le Mar,up /anguage; is a well ,nown standard for storing, carr'ing, and e#changing data. .M/ is standardiAed "' the WB6. @ou can read more a"out .M/ in our .M/ tutorial.
SOAP
S032 :Simple 0">ect 3ccess 2rotocol; is a lightweight platform and language neutral communication protocol that allows programs to communicate $ia standard nternet 1TT2. S032 is standardiAed "' the WB6. @ou can read more a"out S032 in our S032 tutorial.
WSDL
WS+/ :We" Ser$ices +escription /anguage; is an .M/!"ased language used to define we" ser$ices and to descri"e how to access them. WS+/ is a suggestion "' 3ri"a, BM and Microsoft for descri"ing ser$ices for the WB6 .M/ 3cti$it' on .M/ 2rotocols. @ou can read more a"out WS+/ in our WS+/ tutorial.
UDDI
4++ :4ni$ersal +escription, +isco$er' and ntegration; is a director' ser$ice where "usinesses can register and search for we" ser$ices. 4++ is a pu"lic registr', where one can pu"lish and in%uire a"out we" ser$ices.
Since we" ser$ices use .M/ "ased protocols to communicate with other s'stems, we" ser$ices are independent of "oth operating s'stems and programming languages. 3n application calling a we" ser$ice will alwa's send its re%uests using .M/, and get its answer returned as .M/. The calling application will ne$er "e concerned a"out the operating s'stem or the programming language running on the other computer.
We" ser$ices ma,e it easier to communicate "etween different applications. The' also ma,e it possi"le for de$elopers to reuse e#isting we" ser$ices instead of writing new ones. We" ser$ices can create new possi"ilities for man' "usinesses "ecause it pro$ides an eas' wa' to distri"ute information to a large num"er of consumers. 0ne e#ample could "e flight schedules and tic,et reser$ation s'stems.
T'e )aragra)'s $elow descri$es W5Sc'ools' vision a$out future Internet &istri$uted "))lications.
ust die
Neither 677 nor &a$a can e$er create standard components that can run on all computers. There is no room for these languages in future distri"uted applications. E#ecuta"les are not standard. 60M o">ects are not standard, +//!files are not standard. ?egistr' settings are not standard. N !files are not standard. None of these components must "e allowed to destro' 'our dream of a standard distri"uted application that will run on almost an' computer in the world.
%lients
3pplication clients must "e standard clients without an' additional components. No part of the applications must "e stored on client computers. The application must ne$er use, or rel' on, an' components, dll! or ini!files, registr' settings or an' other non standard settings or files stored on the client computer. :Then 'ou can start calling it a Thin 6lient;. 0ur "est suggestion is to let all clients use standard nternet "rowsers li,e nternet E#plorer or Netscape Na$igator running on Windows or Mac computers.
Servers
3pplication ser$ers must "e standard nternet ser$ers running standard software without an' additional components. The application must ne$er use, or rel' on, an' components, dll! or ini!files, registr' settings or an' other non standard settings or files stored on the ser$er. 0ur "est suggestion is to use a standard nternet ser$er li,e nternet nformation Ser$ices : S;, with a standard re%uest!handler li,e 3cti$e Ser$er 2ages :3S2;, and a standard data"ase connector li,e 3cti$e +ata 0">ects :3+0;. 3s 'our data!store 'ou should use a standard S=/ "ased data"ase li,e 0racle or Microsoft's S=/ Ser$er.
"))lications
unication
3pplication clients and ser$ers must not "e allowed to communicate $ia an' proprietar' protocol. 6lients must re%uest ser$ers $ia a standard nternet protocol and ser$ers must respond $ia the same protocol. 6lients must "e a"le to use an' ser$ice without ha$ing to maintain a permanent connection to the ser$er. 0ur "est suggestion is to let ser$ers "e re%uested with standard stateless nternet 1TT2 re%uests. Ser$ers should respond with a standard stateless nternet 1TT2 response.
"))lications
ust $e Services
T'e )aragra)'s $elow descri$es W5Sc'ools' vision a$out future Internet &istri$uted "))lications.
"))lications
3pplications can no longer "e allowed to contain large masses of compiled e#ecuta"le code. 3pplications must "e "ro,en down into a num"er of smaller indi$idual ser$ices that are easier to create and easier to maintain. ndi$idual ser$ices should "e de$eloped and maintained "' smaller groups of people. Ser$ices are not the same as e#ecuta"les, or components, or +//'s. Ser$ices should "e answers to su"mitted re%uests. Ser$ices should "e returned as data. 0ur "est suggestion is to de$elop ser$ices as a num"er of ser$er!side 1TM/ andCor .M/ pages.
Services
0ur histor' is full of applications that were purpose "uilt for a single tas,. Man' of these applications died "efore the' were introduced, "ecause the' could not manage new changes in the re%uirements. This is a terri"le waste of mone' and time. We :and the people that pa' for our applications; want to create fle#i"le applications that are so generaliAed that the' can gracefull' support future changes. 5uture ! not e$en thought a"out ! changes should easil' hoo, into our application without crum"ling or destro'ing it. 0ur "est suggestion is to create fle#i"le standard ser$ices that can "e used to ser$e a lot of different re%uests.
Services
Ser$ices should not "e coded if it can "e a$oided. f a ser$ice has to "e coded, our "est suggestion is to use scripts. Ser$ices should ne$er "e compiled into e#ecuta"les. That ma,es ser$ices too hard to access and to edit. 3n' pre!compiled component used in an application will threaten the possi"ilit' of creating an application that can mo$e, scale and gracefull' support future e#tensions or changes. Ser$ices should "e created and modified "' editing their properties and methods, not "' changing their e#ecuta"le code. 0ur "est suggestion is to use an .M/ editor to create and edit ser$ices, and to use a standard ser$ice engine to pro$ide ser$ices "' e#ecuting the ser$ice description. The ser$ice descriptions should "e stored in a data store li,e a data"ase or in an .M/C1TM/ file.
3pplication clients must "e a"le to %uer' a ser$er for a ser$ice and to as, for the current ser$er functions. 6lients and ser$ers must also "e a"le to e#change data in a wa' so that "oth understand each element in the data. 0ur "est suggestion is to use an .M/ "ased information $oca"ular' with a +T+ :+ocument T'pe +efinition; to e#change ser$er functions, and to use .M/ to e#change data.
T'e )aragra)'s $elow descri$es W5Sc'ools' vision a$out future Internet &istri$uted "))lications.
"))lications
3pplications must "e aware of future changes and gracefull' ad>ust to changes in either the amount of ser$ices or in the e#change format. The application and the data e#change format must support
"oth e#tensions, remo$ed elements and $ersion controls. 0ur "est suggestion is to use .M/ with an .M/ Schema.
"))lications
3pplications must "e a"le to scale from supporting a few to man' thousand re%uests per da'. Ser$er ser$ices must "e a"le to spread from one ser$er to man', or to mo$e from one ser$er to another without "rea,ing the application. 0ur "est suggestion is to ma,e ser$er ser$ices independent of ph'sical ser$er, and to use standard nternet 4niform ?esource /ocators :4?/; or a director' ser$ice to locate the ser$ices.
"))lications
3pplications should "e a"le to cooperate with other applications. 0ur "est suggestion is create all applications with the same rules, and to lin, applications together with standard nternet lin,s.
"))lications
3pplications should "e made read' to support the new nternet Standards as the' emerge from WB6.
Tutorial
1TM/ ser$er controls reference We" ser$er controls reference 9alidation ser$er controls reference
)les
Ta$le of %ontents
3S2 .NET ntroduction This chapter e#plains what 3S2 .NET is. 3S2 .NET $s 3S2 This chapter e#plains the differences "etween 3S2 .NET and 3S2. 3S2 .NET nstalling This chapter e#plains how to install 3S2 .NET. 3S2 .NET 2ages This chapter e#plains how to create 'our first simple 3S2 .NET page. 3S2 .NET Ser$er controls This chapter e#plains the 3S2 .NET ser$er controls. 3S2 .NET E$ents This chapter e#plains some of the 3S2 .NET e$ent handlers.
3S2 .NET The asp*?epeater control This chapter e#plains data "inding to an .M/ file with the ?epeater control. 3S2 .NET The asp*+ata/ist control This chapter e#plains data "inding to an .M/ file with the +ata/ist control.
"S+ .NET 'as $etter language su))ort( a large set of new controls and 4M. $ased co )onents( and $etter user aut'entication. "S+ .NET )rovides increased )erfor ance $y running co )ati$le wit' "S+. )iled code.
.anguage Su))ort
3S2 .NET uses the new 3+0 .NET. 3S2 .NET supports full 9isual Basic, not 9BScript. 3S2 .NET supports 68 :6 sharp; and 677. 3S2 .NET supports &Script as "efore.
"S+ .NET %o
)onents
3S2 .NET components are hea$il' "ased on .M/. /i,e the new 3+ ?otator, that uses .M/ to store ad$ertisement information and configuration.
3ser "ut'entication
3S2 .NET supports forms!"ased user authentication, including coo,ie management and automatic redirecting of unauthoriAed logins. :@ou can still do 'our custom login page and custom user chec,ing;.
;ig' Scala$ility
Much has "een done with 3S2 .NET to pro$ide greater scala"ilit'.
Ser$er to ser$er communication has "een greatl' enhanced, ma,ing it possi"le to scale an application o$er se$eral ser$ers. 0ne e#ample of this is the a"ilit' to run .M/ parsers, .S/ transformations and e$en resource hungr' session o">ects on other ser$ers.
%o
)iled %ode
The first re%uest for an 3S2 .NET page on the ser$er will compile the 3S2 .NET code and ,eep a cached cop' in memor'. The result of this is greatl' increased performance.
Easy %onfiguration
6onfiguration of 3S2 .NET is done with plain te#t files. 6onfiguration files can "e uploaded or changed while the application is running. No need to restart the ser$er. No more meta"ase or registr' puAAle.
Easy &e)loy
ent
No more ser$er restart to deplo' or replace compiled code. 3S2 .NET simpl' redirects all new re%uests to the new code.
%o
)ati$ility
3S2 .NET is not full' compati"le with earlier $ersions of 3S2, so most of the old 3S2 code will need some changes to run under 3S2 .NET. To o$ercome this pro"lem, 3S2 .NET uses a new file e#tension ".asp#". This will ma,e 3S2 .NET applications a"le to run side "' side with standard 3S2 applications on the same ser$er.
Windo&s )*** or XP
f 'ou are serious a"out de$eloping 3S2 .NET applications 'ou should install Windows ())) 2rofessional or Windows .2 2rofessional. n "oth cases, ma,e sure 'ou install the nternet nformation Ser$ices : S; from the 3ddC?emo$e Windows components dialog.
:e
f 'ou ha$e a Beta $ersion of 3S2 .NET installed, we recommend that 'ou completel' uninstall it. 0r e$en "etter* start with a fresh Windows ())) or .2 installation.
Install .NET
5rom 'our Windows 4pdate 'ou can now select to install the Microsoft .NET 5ramewor,. 3fter download, the .NET framewor, will install itself on 'our computer. There are not an' options to select for the installation. <ou s'ould now $e ready to develo) your first "S+ .NET a))lication.
ent =it
f 'ou ha$e the necessar' "andwidth to download o$er EB) MB, 'ou might consider downloading the full Microsoft .NET Software +e$elopment Fit :S+F;. We full' recommend getting the S+F for learning more a"out .NET and for the documentation, samples, and tools included.
f 'ou ha$e a slow nternet connection, 'ou might ha$e pro"lems downloading large files li,e the ser$ice pac,s, the S+F and the latest $ersion of nternet E#plorer. f download speed is a pro"lem, our "est suggestion is to get the latest files from someone else, from a colleague, from a friend, or from one of the 6+s that comes with man' popular computer magaAines. /oo, for Windows ())) Ser$ice 2ac, (, nternet E#plorer <, and the Microsoft .NET 5ramewor,.
" si
)le "S+ .NET )age loo!s >ust li!e an ordinary ;TM. )age.
;ello W5Sc'ools
To start learning 3S2 .NET, we will construct a $er' simple 1TM/ page that will displa' "1ello WBSchools" in an nternet "rowser li,e this*
;ello W5Sc'ools?
3n 3S2 .NET page has the e#tension .asp#. f a "rowser re%uests an 3S2 .NET page, the ser$er processes an' e#ecuta"le code in the page, "efore the result is sent "ac, to the "rowser. The 3S2 .NET page a"o$e does not contain an' e#ecuta"le code, so nothing is e#ecuted. n the ne#t e#amples we will add some e#ecuta"le code to the page to demonstrate the difference "etween static 1TM/ pages and d'namic 3S2 pages.
%lassic "S+
3cti$e Ser$er 2ages :3S2; has "een around for se$eral 'ears. With 3S2, e#ecuta"le code can "e placed inside 1TM/ pages. 2re$ious $ersions of 3S2 :"efore 3S2 .NET; are often called 6lassic 3S2. 3S2 .NET is not full' compati"le with 6lassic 3S2, "ut most 6lassic 3S2 pages will wor, fine as 3S2 .NET pages, with onl' minor changes. f 'ou want to learn more a"out 6lassic 3S2, please $isit our 3S2 Tutorial.
&yna
To demonstrate how 3S2 can displa' pages with d'namic content, we ha$e added some e#ecuta"le code :in red; to the pre$ious e#ample*
<html> <body bgcolor="yellow"> <center> <h2>Hello W3Schools!</h2> <p><%Response.Wr te!now!""%></p> </center> </body> </html>
The code inside the GH !!HI tags is e#ecuted on the ser$er. ?eponse.Write is 3S2 code for writing something to the 1TM/ output stream. Now:; is a function returning the ser$ers current date and time. f 'ou want to tr' it 'ourself, sa$e the code in a file called " dyn)age.as)", and create a lin, to the file li,e this* d'npage.asp
&yna
.i
<html> <body bgcolor="yellow"> <center> <h2>Hello W3Schools!</h2> <p><%Response.Wr te!now!""%></p> </center> </body> </html>
The code a"o$e illustrates a limitation in 6lassic 3S2* The code "loc, has to "e placed where 'ou want the output to appear. With 6lassic 3S2 it is impossi"le to separate e#ecuta"le code from the 1TM/ itself. This ma,es the page difficult to read, and difficult to maintain.
1TM/ Ser$er 6ontrols ! Traditional 1TM/ tags We" Ser$er 6ontrols ! New 3S2 .NET tags 9alidation Ser$er 6ontrols ! 5or input $alidation
<scr pt r#n$t="ser%er"> S#b &$ge'(o$d l n)*.HRe+="http,//www.w3schools.com" -nd S#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$ d="l n)*" r#n$t="ser%er">. s t W3Schools!</$> </+orm> </body> </html>
The e#ecuta"le code itself has "een mo$ed outside the 1TM/.
<$sp,control'n$me
n the following e#ample we declare a Button ser$er control in an .asp# file. Then we create an e$ent handler for the 6lic, e$ent which changes the te#t on the "utton*
<scr pt r#n$t="ser%er"> S#b s#bm t!So#rce /s 0b1ect2 e /s -%ent/rgs" b#tton*.3e4t="5o# cl c)ed me!" -nd S#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,6#tton d="b#tton*" 3e4t="7l c) me!" r#n$t="ser%er" 0n7l c)="s#bm t"/> </+orm> </body> </html>
<$sp,control'n$me
n the following e#ample we declare one Te#tBo# control, one Button control, and one ?ange9alidator control in an .asp# file. f $alidation fails, the te#t "The $alue must "e from E to E))D" will "e displa'ed in the ?ange9alidator control*
<html> <body> <+orm r#n$t="ser%er"> -nter $ n#mber +rom * to *88, <$sp,3e4t6o4 d="tbo4*" r#n$t="ser%er" /> <br /><br /> <$sp,6#tton 3e4t="S#bm t" r#n$t="ser%er" /> <br /> <$sp,R$nge.$l d$tor 7ontrol3o.$l d$te="tbo4*" 9 n m#m.$l#e="*" 9$4 m#m.$l#e="*88" 3ype=":nteger" -n$ble7l entScr pt="+$lse" 3e4t="3he %$l#e m#st be +rom * to *88!" r#n$t="ser%er" /> </+orm> </body> </html>
"n Event ;andler is a su$routine t'at executes code for a given event.
<% lbl*.3e4t="3he d$te $nd t me s " ; now!" %> <html> <body> <+orm r#n$t="ser%er"> <h3><$sp,l$bel d="lbl*" r#n$t="ser%er" /></h3> </+orm> </body> </html>
When will the code a"o$e "e e#ecutedL The answer is* "@ou don't ,now..."
<scr pt r#n$t="ser%er"> S#b &$ge'(o$d lbl*.3e4t="3he d$te $nd t me s " ; now!" -nd S#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <h3><$sp,l$bel d="lbl*" r#n$t="ser%er" /></h3> </+orm> </body> </html>
Note@ The 2ageK/oad e$ent contains no o">ect references or e$ent argumentsD E#ample
<scr pt r#n$t="ser%er"> S#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then lbl*.3e4t="3he d$te $nd t me s " ; now!" end + -nd S#b S#b s#bm t!s /s 0b1ect2 e /s -%ent/rgs" lbl2.3e4t="Hello World!" -nd S#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <h3><$sp,l$bel d="lbl*" r#n$t="ser%er" /></h3> <h3><$sp,l$bel d="lbl2" r#n$t="ser%er" /></h3> <$sp,b#tton te4t="S#bm t" oncl c)="s#bm t" r#n$t="ser%er" /> </+orm> </body> </html>
The e#ample a"o$e will write the "The date and time is...." message onl' the first time the page is loaded. When a user clic,s on the Su"mit "utton, the su"mit su"routine will write "1ello WorldD" to the second la"el, "ut the date and time in the first la"el will not change. E#ample
Gscript runatJ"ser$er"I Su" 2ageK/oad if Not 2age. s2ostBac, then l"lE.Te#tJ"The date and time is " M now:; end if End Su" Su" su"mit:s 3s 0">ect, e 3s E$ent3rgs; l"l(.Te#tJ"1ello WorldD" End Su" GCscriptI GhtmlI G"od'I Gform runatJ"ser$er"I GhBIGasp*la"el idJ"l"lE" runatJ"ser$er" CIGChBI GhBIGasp*la"el idJ"l"l(" runatJ"ser$er" CIGChBI Gasp*"utton te#tJ"Su"mit" onclic,J"su"mit" runatJ"ser$er" CI GCformI GC"od'I GChtmlIGscript runatJ"ser$er"I Su" 2ageK/oad if Not 2age. s2ostBac, then l"lE.Te#tJ"The date and time is " M now:; end if End Su" Su" su"mit:s 3s 0">ect, e 3s E$ent3rgs; l"l(.Te#tJ"1ello WorldD"
End Su" GCscriptI GhtmlI G"od'I Gform runatJ"ser$er"I GhBIGasp*la"el idJ"l"lE" runatJ"ser$er" CIGChBI GhBIGasp*la"el idJ"l"l(" runatJ"ser$er" CIGChBI Gasp*"utton te#tJ"Su"mit" onclic,J"su"mit" runatJ"ser$er" CI GCformI GC"od'I GChtmlI
"ll server controls ust a))ear wit'in a Bfor t'e runatDEserverE attri$ute.
C tag
ust contain
3ll ser$er controls must appear within a GformI tag, and the GformI tag must contain the runatJ"ser$er" attri"ute. The runatJ"ser$er" attri"ute indicates that the form should "e processed on the ser$er. t also indicates that the enclosed controls can "e accessed "' ser$er scripts*
d="'ctl8">
Su$
itting a For
3 form is most often su"mitted "' clic,ing on a "utton. The Button ser$er control in 3S2 .NET has the following format*
<$sp,6#tton
The id attri"ute defines a uni%ue name for the "utton and the te#t attri"ute assigns a la"el to the "utton. The on6lic, e$ent handler specifies a named su"routine to e#ecute. n the following e#ample we declare a Button control in an .asp# file. 3 "utton clic, runs a su"routine which changes the te#t on the "utton* E#ample
Gscript runatJ"ser$er"I Su" su"mit:Source 3s 0">ect, e 3s E$ent3rgs; "uttonE.Te#tJ"@ou clic,ed meD" End Su" GCscriptI GhtmlI G"od'I Gform runatJ"ser$er"I Gasp*Button idJ""uttonE" Te#tJ"6lic, meD" runatJ"ser$er" 0n6lic,J"su"mit"CI GCformI GC"od'I GChtmlI
"ll server controls ust a))ear wit'in a Bfor t'e runatDEserverE attri$ute.
C tag
ust contain
3ll ser$er controls must appear within a GformI tag, and the GformI tag must contain the runatJ"ser$er" attri"ute. The runatJ"ser$er" attri"ute indicates that the form should "e processed on the ser$er. t also indicates that the enclosed controls can "e accessed "' ser$er scripts*
f 'ou select $iew source in an .asp# page containing a form with no name, method, action, or id attri"ute specified, 'ou will see that 3S2 .NET has added these attri"utes to the form. t loo,s something li,e this*
d="'ctl8">
Su$
itting a For
3 form is most often su"mitted "' clic,ing on a "utton. The Button ser$er control in 3S2 .NET has the following format*
<$sp,6#tton
The id attri"ute defines a uni%ue name for the "utton and the te#t attri"ute assigns a la"el to the "utton. The on6lic, e$ent handler specifies a named su"routine to e#ecute. n the following e#ample we declare a Button control in an .asp# file. 3 "utton clic, runs a su"routine which changes the te#t on the "utton* E#ample
<+orm n$me="'ctl8" method="post" $ct on="p$ge.$sp4" < np#t type="h dden" n$me="''.:-WS3/3-"
d="'ctl8">
<html> <body> <+orm $ct on="demo'cl$ss c$sp.$sp4" method="post"> 5o#r n$me, < np#t type="te4t" n$me="+n$me" s Ae="28"> < np#t type="s#bm t" %$l#e="S#bm t"> </+orm> <% d m +n$me +n$me=ReH#est.Corm!"+n$me"" :+ +n$me<>"" 3hen Response.Wr te!"Hello " ; +n$me ; "!"" -nd :+ %> </body> </html>
E#ample 1ere is the new 3S2 .NET wa'. When 'ou clic, on the su"mit "utton, the form $alue will N0T disappear*
<scr pt r#n$t="ser%er"> S#b s#bm t!sender /s 0b1ect2 e /s -%ent/rgs" lbl*.3e4t="Hello " ; t4t*.3e4t ; "!" -nd S#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> 5o#r n$me, <$sp,3e4t6o4 d="t4t*" r#n$t="ser%er" /> <$sp,6#tton 0n7l c)="s#bm t" 3e4t="S#bm t" r#n$t="ser%er" /> <p><$sp,($bel d="lbl*" r#n$t="ser%er" /></p> </+orm> </body> </html>
E#ample :6lic, $iew source in the right frame of the e#ample to see that 3S2 .NET has added a hidden field in the form to maintain the 9iewState;
T'e Text#ox control is used to create a text $ox w'ere t'e user can in)ut text.
<html> <body> <+orm r#n$t="ser%er"> / b$s c 3e4t6o4, <$sp,3e4t6o4 d="tb*" r#n$t="ser%er" /> <br /><br /> / p$ssword 3e4t6o4, <$sp,3e4t6o4 d="tb2" 3e4t9ode="p$ssword" r#n$t="ser%er" /> <br /><br /> / 3e4t6o4 w th te4t, <$sp,3e4t6o4 d="tbF" 3e4t="Hello World!" r#n$t="ser%er" /> <br /><br /> / m#lt l ne 3e4t6o4, <$sp,3e4t6o4 d="tb3" 3e4t9ode="m#lt l ne" r#n$t="ser%er" /> <br /><br /> / 3e4t6o4 w th he ght, <$sp,3e4t6o4 d="tbI" rows="@" 3e4t9ode="m#lt l ne" r#n$t="ser%er" /> <br /><br /> / 3e4t6o4 w th w dth, <$sp,3e4t6o4 d="tb@" col#mns="38" r#n$t="ser%er" /> </+orm> </body> </html>
"dd a Scri)t
The contents and settings of a Te#tBo# control ma' "e changed "' ser$er scripts when a form is su"mitted. 3 form can "e su"mitted "' clic,ing on a "utton or when a user changes the $alue in the Te#tBo# control. n the following e#ample we declare one Te#tBo# control, one Button control, and one /a"el control in an .asp# file. When the su"mit "utton is triggered, the su"mit su"routine is e#ecuted. The su"mit su"routine writes a te#t to the /a"el control*
<scr pt r#n$t="ser%er"> S#b s#bm t!sender /s 0b1ect2 e /s -%ent/rgs" lbl*.3e4t="5o#r n$me s " ; t4t*.3e4t -nd S#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> -nter yo#r n$me, <$sp,3e4t6o4 d="t4t*" r#n$t="ser%er" /> <$sp,6#tton 0n7l c)="s#bm t" 3e4t="S#bm t" r#n$t="ser%er" /> <p><$sp,($bel d="lbl*" r#n$t="ser%er" /></p> </+orm> </body> </html>
E#ample n the following e#ample we declare one Te#tBo# control and one /a"el control in an .asp# file. When 'ou change the $alue in the Te#tBo# and either clic, outside the Te#tBo# or press the Ta" ,e', the change su"routine is e#ecuted. The su"mit su"routine writes a te#t to the /a"el control*
<scr pt r#n$t="ser%er"> S#b ch$nge!sender /s 0b1ect2 e /s -%ent/rgs" lbl*.3e4t="5o# ch$nged te4t to " ; t4t*.3e4t -nd S#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> -nter yo#r n$me, <$sp,3e4t6o4 d="t4t*" r#n$t="ser%er" te4t="Hello World!" onte4tch$nged="ch$nge" $#topostb$c)="tr#e"/> <p><$sp,($bel d="lbl*" r#n$t="ser%er" /></p> </+orm> </body> </html>
3 su"mit "utton does not ha$e a command name and it posts the page "ac, to the ser$er when it is clic,ed. t is possi"le to write an e$ent handler to control the actions performed when the su"mit "utton is clic,ed. 3 command "utton has a command name and allows 'ou to create multiple Button controls on a page. t is possi"le to write an e$ent handler to control the actions performed when the command "utton is clic,ed. The Button control's attri"utes and properties are listed in our we" controls reference page. The e#ample "elow demonstrates a simple Button control*
<html> <body> <+orm r#n$t="ser%er"> <$sp,6#tton d="b*" 3e4t="S#bm t" r#n$t="ser%er" /> </+orm> </body> </html>
"dd a Scri)t
3 form is most often su"mitted "' clic,ing on a "utton. n the following e#ample we declare one Te#tBo# control, one Button control, and one /a"el control in an .asp# file. When the su"mit "utton is triggered, the su"mit su"routine is e#ecuted. The su"mit su"routine writes a te#t to the /a"el control*
<scr pt r#n$t="ser%er"> S#b s#bm t!sender /s 0b1ect2 e /s -%ent/rgs" lbl*.3e4t="5o#r n$me s " ; t4t*.3e4t -nd S#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> -nter yo#r n$me, <$sp,3e4t6o4 d="t4t*" r#n$t="ser%er" /> <$sp,6#tton 0n7l c)="s#bm t" 3e4t="S#bm t" r#n$t="ser%er" /> <p><$sp,($bel d="lbl*" r#n$t="ser%er" /></p> </+orm> </body> </html>
Gscript runatJ"ser$er"I Su" su"mit:sender 3s 0">ect, e 3s E$ent3rgs; l"lE.Te#tJ"@our name is " M t#tE.Te#t End Su" GCscriptI GhtmlI G"od'I
Gform runatJ"ser$er"I Enter 'our name* Gasp*Te#tBo# idJ"t#tE" runatJ"ser$er" CI Gasp*Button 0n6lic,J"su"mit" Te#tJ"Su"mit" runatJ"ser$er" CI GpIGasp*/a"el idJ"l"lE" runatJ"ser$er" CIGCpI GCformI GC"od'I GChtmlI
We ay use data $inding to fill lists wit' selecta$le ite li!e a data$ase( an 4M. file( or a scri)t.
s fro
an i
&ata #inding
The following controls are list controls which support data "inding*
The selecta"le items in each of the a"o$e controls are usuall' defined "' one or more asp*/ist tem controls, li,e this*
<html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="co#ntryl st" r#n$t="ser%er"> <$sp,( st:tem %$l#e="<" te4t="<orw$y" /> <$sp,( st:tem %$l#e="S" te4t="Sweden" /> <$sp,( st:tem %$l#e="C" te4t="Cr$nce" /> <$sp,( st:tem %$l#e=":" te4t=":t$ly" /> </$sp,R$d o6#tton( st> </+orm> </body> </html>
1owe$er, with data "inding we ma' use a separate source, li,e a data"ase, an .M/ file, or a script to fill the list with selecta"le items. B' using an imported source, the data is separated from the 1TM/, and an' changes to the items are made in the separate data source. n the ne#t three chapters, we will descri"e how to "ind data from a scripted data source.
Exa
)les
%reate an "rray.ist
The 3rra'/ist o">ect is a collection of items containing a single data $alue. tems are added to the 3rra'/ist with the 3dd:; method. The following code creates a new 3rra'/ist o">ect named m'countries and four items are added*
<scr pt r#n$t="ser%er"> S#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew /rr$y( st myco#ntr es./dd!"<orw$y"" myco#ntr es./dd!"Sweden"" myco#ntr es./dd!"Cr$nce"" myco#ntr es./dd!":t$ly"" end + end s#b </scr pt>
B' default, an 3rra'/ist o">ect contains E< entries. 3n 3rra'/ist can "e siAed to its final siAe with the TrimToSiAe:; method*
<scr pt r#n$t="ser%er"> S#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew /rr$y( st myco#ntr es./dd!"<orw$y"" myco#ntr es./dd!"Sweden"" myco#ntr es./dd!"Cr$nce"" myco#ntr es./dd!":t$ly"" myco#ntr es.3r m3oS Ae!" end + end s#b </scr pt>
3n 3rra'/ist can also "e sorted alpha"eticall' or numericall' with the Sort:; method*
<scr pt r#n$t="ser%er"> S#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew /rr$y( st
myco#ntr myco#ntr myco#ntr myco#ntr myco#ntr myco#ntr end + end s#b </scr pt>
To sort in re$erse order, appl' the ?e$erse:; method after the Sort:; method*
<scr pt r#n$t="ser%er"> S#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew /rr$y( st myco#ntr es./dd!"<orw$y"" myco#ntr es./dd!"Sweden"" myco#ntr es./dd!"Cr$nce"" myco#ntr es./dd!":t$ly"" myco#ntr es.3r m3oS Ae!" myco#ntr es.Sort!" myco#ntr es.Re%erse!" end + end s#b </scr pt>
To "ind data to a ?adioButton/ist control, first create a ?adioButton/ist control :without an' asp*/ist tem elements; in an .asp# page*
<html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="rb" r#n$t="ser%er" /> </+orm> </body> </html>
Then add the script that "uilds the list and "inds the $alues in the list to the ?adioButton/ist control*
d m myco#ntr es=<ew /rr$y( st myco#ntr es./dd!"<orw$y"" myco#ntr es./dd!"Sweden"" myco#ntr es./dd!"Cr$nce"" myco#ntr es./dd!":t$ly"" myco#ntr es.3r m3oS Ae!" myco#ntr es.Sort!" rb.>$t$So#rce=myco#ntr es rb.>$t$6 nd!" end + end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="rb" r#n$t="ser%er" /> </+orm> </body> </html>
The +ataSource propert' of the ?adioButton/ist control is set to the 3rra'/ist and it defines the data source of the ?adioButton/ist control. The +ataBind:; method of the ?adioButton/ist control "inds the data source with the ?adioButton/ist control. Note@ The data $alues are used as "oth the Te#t and 9alue properties for the control. To add 9alues that are different from the Te#t, use either the 1ashta"le o">ect or the Sorted/ist o">ect.
s in !eyFvalue )airs.
Exa
)les
%reate a ;as'ta$le
The 1ashta"le o">ect contains items in ,e'C$alue pairs. The ,e's are used as inde#es, and $er' %uic, searches can "e made for $alues "' searching through their ,e's. tems are added to the 1ashta"le with the 3dd:; method. The following code creates a 1ashta"le named m'countries and four elements are added*
+ <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew H$sht$ble myco#ntr es./dd!"<"2"<orw$y"" myco#ntr es./dd!"S"2"Sweden"" myco#ntr es./dd!"C"2"Cr$nce"" myco#ntr es./dd!":"2":t$ly"" end + end s#b </scr pt>
&ata #inding
3 1ashta"le o">ect ma' automaticall' generate the te#t and $alues to the following controls*
To "ind data to a ?adioButton/ist control, first create a ?adioButton/ist control :without an' asp*/ist tem elements; in an .asp# page*
<html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="rb" r#n$t="ser%er" /#to&ost6$c)="3r#e" /> </+orm> </body> </html>
Then add the script that "uilds the list*
<scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew H$sht$ble myco#ntr es./dd!"<"2"<orw$y"" myco#ntr es./dd!"S"2"Sweden"" myco#ntr es./dd!"C"2"Cr$nce"" myco#ntr es./dd!":"2":t$ly"" rb.>$t$So#rce=myco#ntr es rb.>$t$.$l#eC eld="Jey" rb.>$t$3e4tC eld=".$l#e" rb.>$t$6 nd!" end + end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="rb" r#n$t="ser%er" /#to&ost6$c)="3r#e" /> </+orm>
</body> </html>
Then we add a su" routine to "e e#ecuted when the user clic,s on an item in the ?adioButton/ist control. When a radio "utton is clic,ed, a te#t will appear in a la"el*
<scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew H$sht$ble myco#ntr es./dd!"<"2"<orw$y"" myco#ntr es./dd!"S"2"Sweden"" myco#ntr es./dd!"C"2"Cr$nce"" myco#ntr es./dd!":"2":t$ly"" rb.>$t$So#rce=myco#ntr es rb.>$t$.$l#eC eld="Jey" rb.>$t$3e4tC eld=".$l#e" rb.>$t$6 nd!" end + end s#b s#b d spl$y9ess$ge!s $s 0b1ect2e /s -%ent/rgs" lbl*.te4t="5o#r +$%or te co#ntry s, " ; rb.Selected:tem.3e4t end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="rb" r#n$t="ser%er" /#to&ost6$c)="3r#e" onSelected:nde47h$nged="d spl$y9ess$ge" /> <p><$sp,l$bel d="lbl*" r#n$t="ser%er" /></p> </+orm> </body> </html>
Note@ @ou cannot choose the sort order of the items added to the 1ashta"le. To sort items alpha"eticall' or numericall', use the Sorted/ist o">ect.
Gscript runatJ"ser$er"I su" 2ageK/oad if Not 2age. s2ostBac, then dim m'countriesJNew 1ashta"le m'countries.3dd:"N","Norwa'"; m'countries.3dd:"S","Sweden"; m'countries.3dd:"5","5rance"; m'countries.3dd:" "," tal'"; r".+ataSourceJm'countries r".+ata9alue5ieldJ"Fe'" r".+ataTe#t5ieldJ"9alue" r".+ataBind:; end if end su" su" displa'Message:s as 0">ect,e 3s E$ent3rgs; l"lE.te#tJ"@our fa$orite countr' is* " M r".Selected tem.Te#t end su"
GCscriptI GhtmlI G"od'I Gform runatJ"ser$er"I Gasp*?adioButton/ist idJ"r"" runatJ"ser$er" 3uto2ostBac,J"True" onSelected nde#6hangedJ"displa'Message" CI GpIGasp*la"el idJ"l"lE" runatJ"ser$er" CIGCpI GCformI GC"od'I GChtmlI Gscript runatJ"ser$er"I su" 2ageK/oad if Not 2age. s2ostBac, then dim na$igateJNew 1ashta"le na$igate.3dd:"?adioButton/ist","controlKradio"uttonlist.asp"; na$igate.3dd:"6hec,Bo#/ist","controlKchec,"o#list.asp"; na$igate.3dd:"+rop+own/ist","controlKdropdownlist.asp"; na$igate.3dd:"/istBo#","controlKlist"o#.asp"; r".+ataSourceJna$igate r".+ata9alue5ieldJ"9alue" r".+ataTe#t5ieldJ"Fe'" r".+ataBind:; end if end su" su" na$igate:s as 0">ect, e 3s E$ent3rgs; response.redirect:r".Selected tem.9alue; end su" GCscriptI GhtmlI G"od'I Gform runatJ"ser$er"I Gasp*?adioButton/ist idJ"r"" runatJ"ser$er" 3uto2ostBac,J"True" onSelected nde#6hangedJ"na$igate" CI GCformI GC"od'I GChtmlI Gscript runatJ"ser$er"I su" 2ageK/oad if Not 2age. s2ostBac, then dim m'countriesJNew 1ashta"le m'countries.3dd:"N","Norwa'"; m'countries.3dd:"S","Sweden"; m'countries.3dd:"5","5rance"; m'countries.3dd:" "," tal'";
dd.+ataSourceJm'countries dd.+ata9alue5ieldJ"Fe'" dd.+ataTe#t5ieldJ"9alue" dd.+ataBind:; end if end su" su" displa'Message:s as 0">ect,e 3s E$ent3rgs; l"lE.te#tJ"@our fa$orite countr' is* " M dd.Selected tem.Te#t end su" GCscriptI GhtmlI G"od'I Gform runatJ"ser$er"I Gasp*+rop+own/ist idJ"dd" runatJ"ser$er" 3uto2ostBac,J"True" onSelected nde#6hangedJ"displa'Message" CI GpIGasp*la"el idJ"l"lE" runatJ"ser$er" CIGCpI GCformI GC"od'I GChtmlI
Exa
)les
<scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew Sorted( st myco#ntr es./dd!"<"2"<orw$y"" myco#ntr es./dd!"S"2"Sweden"" myco#ntr es./dd!"C"2"Cr$nce"" myco#ntr es./dd!":"2":t$ly"" end + end s#b </scr pt>
&ata #inding
3 Sorted/ist o">ect ma' automaticall' generate the te#t and $alues to the following controls*
To "ind data to a ?adioButton/ist control, first create a ?adioButton/ist control :without an' asp*/ist tem elements; in an .asp# page*
<html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="rb" r#n$t="ser%er" /#to&ost6$c)="3r#e" /> </+orm> </body> </html>
Then add the script that "uilds the list*
<scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew Sorted( st myco#ntr es./dd!"<"2"<orw$y"" myco#ntr es./dd!"S"2"Sweden"" myco#ntr es./dd!"C"2"Cr$nce"" myco#ntr es./dd!":"2":t$ly"" rb.>$t$So#rce=myco#ntr es rb.>$t$.$l#eC eld="Jey" rb.>$t$3e4tC eld=".$l#e" rb.>$t$6 nd!" end + end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="rb" r#n$t="ser%er"
<scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew Sorted( st myco#ntr es./dd!"<"2"<orw$y"" myco#ntr es./dd!"S"2"Sweden"" myco#ntr es./dd!"C"2"Cr$nce"" myco#ntr es./dd!":"2":t$ly"" rb.>$t$So#rce=myco#ntr es rb.>$t$.$l#eC eld="Jey" rb.>$t$3e4tC eld=".$l#e" rb.>$t$6 nd!" end + end s#b s#b d spl$y9ess$ge!s $s 0b1ect2e /s -%ent/rgs" lbl*.te4t="5o#r +$%or te co#ntry s, " ; rb.Selected:tem.3e4t end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="rb" r#n$t="ser%er" /#to&ost6$c)="3r#e" onSelected:nde47h$nged="d spl$y9ess$ge" /> <p><$sp,l$bel d="lbl*" r#n$t="ser%er" /></p> </+orm> </body> </html>
Exa
)les
<K4ml %ers on="*.8" encod ng=":S0LMM@EL*"K> <co#ntr es> <co#ntry> <te4t><orw$y</te4t> <%$l#e><</%$l#e> </co#ntry> <co#ntry> <te4t>Sweden</te4t> <%$l#e>S</%$l#e> </co#ntry> <co#ntry> <te4t>Cr$nce</te4t> <%$l#e>C</%$l#e> </co#ntry> <co#ntry> <te4t>:t$ly</te4t> <%$l#e>:</%$l#e> </co#ntry> </co#ntr es>
Ta,e a loo, at the .M/ file* countries.#ml
<scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew >$t$Set myco#ntr es.Re$dOml!9$p&$th!"co#ntr es.4ml""" end + end s#b
To "ind the +ataSet to a ?adioButton/ist control, first create a ?adioButton/ist control :without an' asp*/ist tem elements; in an .asp# page*
<html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="rb" r#n$t="ser%er" /#to&ost6$c)="3r#e" /> </+orm> </body> </html>
Then add the script that "uilds the .M/ +ataSet*
<%N :mport <$mesp$ce="System.>$t$" %> <scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew >$t$Set myco#ntr es.Re$dOml!9$p&$th!"co#ntr es.4ml""" rb.>$t$So#rce=myco#ntr es rb.>$t$.$l#eC eld="%$l#e" rb.>$t$3e4tC eld="te4t" rb.>$t$6 nd!" end + end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="rb" r#n$t="ser%er" /#to&ost6$c)="3r#e" onSelected:nde47h$nged="d spl$y9ess$ge" /> </+orm> </body> </html>
Then we add a su" routine to "e e#ecuted when the user clic,s on an item in the ?adioButton/ist control. When a radio "utton is clic,ed, a te#t will appear in a la"el*
<%N :mport <$mesp$ce="System.>$t$" %> <scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m myco#ntr es=<ew >$t$Set myco#ntr es.Re$dOml!9$p&$th!"co#ntr es.4ml""" rb.>$t$So#rce=myco#ntr es rb.>$t$.$l#eC eld="%$l#e" rb.>$t$3e4tC eld="te4t" rb.>$t$6 nd!" end + end s#b s#b d spl$y9ess$ge!s $s 0b1ect2e /s -%ent/rgs" lbl*.te4t="5o#r +$%or te co#ntry s, " ; rb.Selected:tem.3e4t end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,R$d o6#tton( st d="rb" r#n$t="ser%er" /#to&ost6$c)="3r#e" onSelected:nde47h$nged="d spl$y9ess$ge" /> <p><$sp,l$bel d="lbl*" r#n$t="ser%er" /></p> </+orm> </body> </html>
Exa
)les
?epeater control ?epeater control with G3lternating temTemplateI ?epeater control with GSeparatorTemplateI
<K4ml %ers on="*.8" encod ng=":S0LMM@EL*"K> <c$t$log> <cd> <t tle>-mp re 6#rlesH#e</t tle> <$rt st>6ob >yl$n</$rt st> <co#ntry>?S/</co#ntry> <comp$ny>7ol#mb $</comp$ny> <pr ce>*8.E8</pr ce> <ye$r>*EM@</ye$r> </cd> <cd> <t tle>H de yo#r he$rt</t tle> <$rt st>6onn e 3yler</$rt st> <co#ntry>?J</co#ntry> <comp$ny>76S Records</comp$ny> <pr ce>E.E8</pr ce> <ye$r>*EMM</ye$r> </cd> <cd> <t tle>Pre$test H ts</t tle> <$rt st>>olly &$rton</$rt st> <co#ntry>?S/</co#ntry> <comp$ny>R7/</comp$ny> <pr ce>E.E8</pr ce> <ye$r>*EM2</ye$r> </cd> <cd> <t tle>St ll got the bl#es</t tle> <$rt st>P$ry 9oore</$rt st> <co#ntry>?J</co#ntry> <comp$ny>. rg n records</comp$ny> <pr ce>*8.28</pr ce> <ye$r>*EE8</ye$r> </cd> <cd> <t tle>-ros</t tle>
<$rt st>-ros R$m$AAott </$rt st> <co#ntry>-?</co#ntry> <comp$ny>69P</comp$ny> <pr ce>E.E8</pr ce> <ye$r>*EED</ye$r> </cd> </c$t$log>
Ta,e a loo, at the .M/ file* cdcatalog.#ml 5irst, import the "S'stem.+ata" namespace. We need this namespace to wor, with +ataSet o">ects. nclude the following directi$e at the top of an .asp# page*
<scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m mycdc$t$log=<ew >$t$Set mycdc$t$log.Re$dOml!9$p&$th!"cdc$t$log.4ml""" end + end s#b
Then we create a ?epeater control in an .asp# page. The contents of the G1eaderTemplateI element are rendered first and onl' once within the output, then the contents of the G temTemplateI element are repeated for each "record" in the +ataSet, and last, the contents of the G5ooterTemplateI element are rendered once within the output*
<html> <body> <+orm r#n$t="ser%er"> <$sp,Repe$ter d="cdc$t$log" r#n$t="ser%er"> <He$der3empl$te> ... </He$der3empl$te> <:tem3empl$te> ... </:tem3empl$te> <Cooter3empl$te> ... </Cooter3empl$te> </$sp,Repe$ter> </+orm> </html> </body>
Then we add the script that creates the +ataSet and "inds the m'cdcatalog +ataSet to the ?epeater control. We also fill the ?epeater control with 1TM/ tags and "ind the data items to the cells in theG temTemplateI section with the GH86ontainer.+ata tem:"fieldname";HI method*
<scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m mycdc$t$log=<ew >$t$Set mycdc$t$log.Re$dOml!9$p&$th!"cdc$t$log.4ml""" cdc$t$log.>$t$So#rce=mycdc$t$log cdc$t$log.>$t$6 nd!" end + end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,Repe$ter d="cdc$t$log" r#n$t="ser%er"> <He$der3empl$te> <t$ble border="*" w dth="*88%"> <tr> <th>3 tle</th> <th>/rt st</th> <th>7o#ntry</th> <th>7omp$ny</th> <th>&r ce</th> <th>5e$r</th> </tr> </He$der3empl$te> <:tem3empl$te> <tr> <td><%Q7ont$ ner.>$t$:tem!"t tle""%></td> <td><%Q7ont$ ner.>$t$:tem!"$rt st""%></td> <td><%Q7ont$ ner.>$t$:tem!"co#ntry""%></td> <td><%Q7ont$ ner.>$t$:tem!"comp$ny""%></td> <td><%Q7ont$ ner.>$t$:tem!"pr ce""%></td> <td><%Q7ont$ ner.>$t$:tem!"ye$r""%></td> </tr> </:tem3empl$te> <Cooter3empl$te> </t$ble> </Cooter3empl$te> </$sp,Repe$ter> </+orm> </html> </body>
Te
)lateC
@ou can add an G3lternating temTemplateI element after the G temTemplateI element to descri"e the appearance of alternating rows of output. n the following e#ample each other row in the ta"le will "e displa'ed in a light gre' color*
<%N :mport <$mesp$ce="System.>$t$" %> <scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m mycdc$t$log=<ew >$t$Set mycdc$t$log.Re$dOml!9$p&$th!"cdc$t$log.4ml""" cdc$t$log.>$t$So#rce=mycdc$t$log cdc$t$log.>$t$6 nd!"
end + end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,Repe$ter d="cdc$t$log" r#n$t="ser%er"> <He$der3empl$te> <t$ble border="*" w dth="*88%"> <tr> <th>3 tle</th> <th>/rt st</th> <th>7o#ntry</th> <th>7omp$ny</th> <th>&r ce</th> <th>5e$r</th> </tr> </He$der3empl$te> <:tem3empl$te> <tr> <td><%Q7ont$ ner.>$t$:tem!"t tle""%></td> <td><%Q7ont$ ner.>$t$:tem!"$rt st""%></td> <td><%Q7ont$ ner.>$t$:tem!"co#ntry""%></td> <td><%Q7ont$ ner.>$t$:tem!"comp$ny""%></td> <td><%Q7ont$ ner.>$t$:tem!"pr ce""%></td> <td><%Q7ont$ ner.>$t$:tem!"ye$r""%></td> </tr> </:tem3empl$te> </ltern$t ng:tem3empl$te> <tr bgcolor="QeMeMeM"> <td><%Q7ont$ ner.>$t$:tem!"t tle""%></td> <td><%Q7ont$ ner.>$t$:tem!"$rt st""%></td> <td><%Q7ont$ ner.>$t$:tem!"co#ntry""%></td> <td><%Q7ont$ ner.>$t$:tem!"comp$ny""%></td> <td><%Q7ont$ ner.>$t$:tem!"pr ce""%></td> <td><%Q7ont$ ner.>$t$:tem!"ye$r""%></td> </tr> <//ltern$t ng:tem3empl$te> <Cooter3empl$te> </t$ble> </Cooter3empl$te> </$sp,Repe$ter> </+orm> </html> </body>
)lateC
The GSeparatorTemplateI element can "e used to descri"e a separator "etween each record. The following e#ample inserts a horiAontal line "etween each ta"le row*
<%N :mport <$mesp$ce="System.>$t$" %> <scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m mycdc$t$log=<ew >$t$Set mycdc$t$log.Re$dOml!9$p&$th!"cdc$t$log.4ml"""
cdc$t$log.>$t$So#rce=mycdc$t$log cdc$t$log.>$t$6 nd!" end + end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,Repe$ter d="cdc$t$log" r#n$t="ser%er"> <He$der3empl$te> <t$ble border="8" w dth="*88%"> <tr> <th>3 tle</th> <th>/rt st</th> <th>7o#ntry</th> <th>7omp$ny</th> <th>&r ce</th> <th>5e$r</th> </tr> </He$der3empl$te> <:tem3empl$te> <tr> <td><%Q7ont$ ner.>$t$:tem!"t tle""%></td> <td><%Q7ont$ ner.>$t$:tem!"$rt st""%></td> <td><%Q7ont$ ner.>$t$:tem!"co#ntry""%></td> <td><%Q7ont$ ner.>$t$:tem!"comp$ny""%></td> <td><%Q7ont$ ner.>$t$:tem!"pr ce""%></td> <td><%Q7ont$ ner.>$t$:tem!"ye$r""%></td> </tr> </:tem3empl$te> <Sep$r$tor3empl$te> <tr> <td colsp$n="I"><hr /></td> </tr> </Sep$r$tor3empl$te> <Cooter3empl$te> </t$ble> </Cooter3empl$te> </$sp,Repe$ter> </+orm> </html> </body>
T'e &ata.ist control is( li!e t'e :e)eater control( used to dis)lay a re)eated list of ite s t'at are $ound to t'e control. ;owever( t'e &ata.ist control adds a ta$le around t'e data ite s $y default.
Exa
)les
+ata/ist control
<K4ml %ers on="*.8" encod ng=":S0LMM@EL*"K> <c$t$log> <cd> <t tle>-mp re 6#rlesH#e</t tle> <$rt st>6ob >yl$n</$rt st> <co#ntry>?S/</co#ntry> <comp$ny>7ol#mb $</comp$ny> <pr ce>*8.E8</pr ce> <ye$r>*EM@</ye$r> </cd> <cd> <t tle>H de yo#r he$rt</t tle> <$rt st>6onn e 3yler</$rt st> <co#ntry>?J</co#ntry> <comp$ny>76S Records</comp$ny> <pr ce>E.E8</pr ce> <ye$r>*EMM</ye$r> </cd> <cd> <t tle>Pre$test H ts</t tle> <$rt st>>olly &$rton</$rt st> <co#ntry>?S/</co#ntry> <comp$ny>R7/</comp$ny> <pr ce>E.E8</pr ce> <ye$r>*EM2</ye$r> </cd> <cd> <t tle>St ll got the bl#es</t tle> <$rt st>P$ry 9oore</$rt st> <co#ntry>?J</co#ntry> <comp$ny>. rg n records</comp$ny> <pr ce>*8.28</pr ce> <ye$r>*EE8</ye$r> </cd> <cd> <t tle>-ros</t tle> <$rt st>-ros R$m$AAott </$rt st> <co#ntry>-?</co#ntry> <comp$ny>69P</comp$ny> <pr ce>E.E8</pr ce> <ye$r>*EED</ye$r> </cd> </c$t$log>
Ta,e a loo, at the .M/ file* cdcatalog.#ml 5irst, import the "S'stem.+ata" namespace. We need this namespace to wor, with +ataSet o">ects. nclude the following directi$e at the top of an .asp# page*
<scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m mycdc$t$log=<ew >$t$Set mycdc$t$log.Re$dOml!9$p&$th!"cdc$t$log.4ml""" end + end s#b
Then we create a +ata/ist in an .asp# page. The contents of the G1eaderTemplateI element are rendered first and onl' once within the output, then the contents of the G temTemplateI element are repeated for each "record" in the +ataSet, and last, the contents of the G5ooterTemplateI element are rendered once within the output*
<html> <body> <+orm r#n$t="ser%er"> <$sp,>$t$( st d="cdc$t$log" r#n$t="ser%er"> <He$der3empl$te> ... </He$der3empl$te> <:tem3empl$te> ... </:tem3empl$te> <Cooter3empl$te> ... </Cooter3empl$te> </$sp,>$t$( st> </+orm> </body> </html>
Then we add the script that creates the +ataSet and "inds the m'cdcatalog +ataSet to the +ata/ist control. We also fill the +ata/ist control with a G1eaderTemplateI that contains the header of the ta"le, an G temTemplateI that contains the data items to displa', and a G5ooterTemplateI that contains a te#t. Note that the gridlines attri"ute of the +ata/ist is set to ""oth" to displa' ta"le "orders*
<%N :mport <$mesp$ce="System.>$t$" %> <scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m mycdc$t$log=<ew >$t$Set mycdc$t$log.Re$dOml!9$p&$th!"cdc$t$log.4ml""" cdc$t$log.>$t$So#rce=mycdc$t$log cdc$t$log.>$t$6 nd!"
end + end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,>$t$( st d="cdc$t$log" gr dl nes="both" r#n$t="ser%er"> <He$der3empl$te> 9y 7> 7$t$log </He$der3empl$te> <:tem3empl$te> "<%Q7ont$ ner.>$t$:tem!"t tle""%>" o+ <%Q7ont$ ner.>$t$:tem!"$rt st""%> L R<%Q7ont$ ner.>$t$:tem!"pr ce""%> </:tem3empl$te> <Cooter3empl$te> 7opyr ght Hege Re+snes </Cooter3empl$te> </$sp,>$t$( st> </+orm> </body> </html>
3sing Styles
@ou can also add st'les to the +ata/ist control to ma,e the output more fanc'*
<%N :mport <$mesp$ce="System.>$t$" %> <scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m mycdc$t$log=<ew >$t$Set mycdc$t$log.Re$dOml!9$p&$th!"cdc$t$log.4ml""" cdc$t$log.>$t$So#rce=mycdc$t$log cdc$t$log.>$t$6 nd!" end + end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,>$t$( st d="cdc$t$log" r#n$t="ser%er" cellp$dd ng="2" cellsp$c ng="2" borderstyle=" nset" b$c)color="QeMeMeM" w dth="*88%" he$derstyleL+ontLn$me=".erd$n$" he$derstyleL+ontLs Ae="*2pt" he$derstyleLhor Aont$l$l gn="center" he$derstyleL+ontLbold="tr#e" temstyleLb$c)color="QDDMMEE" temstyleL+orecolor="Q++++++" +ooterstyleL+ontLs Ae="Ept" +ooterstyleL+ontL t$l c="tr#e">
<He$der3empl$te> 9y 7> 7$t$log </He$der3empl$te> <:tem3empl$te> "<%Q7ont$ ner.>$t$:tem!"t tle""%>" o+ <%Q7ont$ ner.>$t$:tem!"$rt st""%> L R<%Q7ont$ ner.>$t$:tem!"pr ce""%> </:tem3empl$te> <Cooter3empl$te> 7opyr ght Hege Re+snes </Cooter3empl$te> </$sp,>$t$( st> </+orm> </body> </html>
Te
)lateC
@ou can add an G3lternating temTemplateI element after the G temTemplateI element to descri"e the appearance of alternating rows of output. @ou ma' st'le the data in the G3lternating temTemplateI section within the +ata/ist control*
<%N :mport <$mesp$ce="System.>$t$" %> <scr pt r#n$t="ser%er"> s#b &$ge'(o$d + <ot &$ge.:s&ost6$c) then d m mycdc$t$log=<ew >$t$Set mycdc$t$log.Re$dOml!9$p&$th!"cdc$t$log.4ml""" cdc$t$log.>$t$So#rce=mycdc$t$log cdc$t$log.>$t$6 nd!" end + end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,>$t$( st d="cdc$t$log" r#n$t="ser%er" cellp$dd ng="2" cellsp$c ng="2" borderstyle=" nset" b$c)color="QeMeMeM" w dth="*88%" he$derstyleL+ontLn$me=".erd$n$" he$derstyleL+ontLs Ae="*2pt" he$derstyleLhor Aont$l$l gn="center" he$derstyleL+ontLbold="3r#e" temstyleLb$c)color="QDDMMEE" temstyleL+orecolor="Q++++++" $ltern$t ng temstyleLb$c)color="QeMeMeM" $ltern$t ng temstyleL+orecolor="Q888888" +ooterstyleL+ontLs Ae="Ept" +ooterstyleL+ontL t$l c="3r#e"> <He$der3empl$te> 9y 7> 7$t$log </He$der3empl$te> <:tem3empl$te>
"<%Q7ont$ ner.>$t$:tem!"t tle""%>" o+ <%Q7ont$ ner.>$t$:tem!"$rt st""%> L R<%Q7ont$ ner.>$t$:tem!"pr ce""%> </:tem3empl$te> </ltern$t ng:tem3empl$te> "<%Q7ont$ ner.>$t$:tem!"t tle""%>" o+ <%Q7ont$ ner.>$t$:tem!"$rt st""%> L R<%Q7ont$ ner.>$t$:tem!"pr ce""%> <//ltern$t ng:tem3empl$te> <Cooter3empl$te> ;copyS Hege Re+snes </Cooter3empl$te> </$sp,>$t$( st> </+orm> </body> </html>
"&* .NET is a )art of t'e .NET Fra ewor! and it is used to 'andle data access. Wit' "&* .NET you can wor! wit' data$ases.
Exa
)les
+ata"ase connection ! Bind to a ?epeater control +ata"ase connection ! Bind to a +ata/ist control
s#b &$ge'(o$d d m dbconn dbconn=<ew 0le>b7onnect on!"&ro% der=9 croso+t.Tet.0(->6.F.8S d$t$ so#rce=" ; ser%er.m$pp$th!"northw nd.mdb""" dbconn.0pen!" end s#b </scr pt>
Note@ The connection string must "e a continuous string without a line "rea,D
%reate a &ata$ase %o
and
To specif' the records to retrie$e from the data"ase, we will create a d"comm $aria"le as a new 0le+"6ommand class. The 0le+"6ommand class is for issuing S=/ %ueries against data"ase ta"les*
<%N :mport <$mesp$ce="System.>$t$.0le>b" %> <scr pt r#n$t="ser%er"> s#b &$ge'(o$d d m dbconn2sHl2dbcomm dbconn=<ew 0le>b7onnect on!"&ro% der=9 croso+t.Tet.0(->6.F.8S d$t$ so#rce=" ; ser%er.m$pp$th!"northw nd.mdb""" dbconn.0pen!" sHl="S-(-73 U CR09 c#stomers" dbcomm=<ew 0le>b7omm$nd!sHl2dbconn" end s#b </scr pt>
%reate a &ata:eader
The 0le+"+ata?eader class is used to read a stream of records from a data source. 3 +ata?eader is created "' calling the E#ecute?eader method of the 0le+"6ommand o">ect*
<%N :mport <$mesp$ce="System.>$t$.0le>b" %> <scr pt r#n$t="ser%er"> s#b &$ge'(o$d d m dbconn2sHl2dbcomm2dbre$d dbconn=<ew 0le>b7onnect on!"&ro% der=9 croso+t.Tet.0(->6.F.8S d$t$ so#rce=" ; ser%er.m$pp$th!"northw nd.mdb""" dbconn.0pen!" sHl="S-(-73 U CR09 c#stomers" dbcomm=<ew 0le>b7omm$nd!sHl2dbconn" dbre$d=dbcomm.-4ec#teRe$der!" end s#b </scr pt>
d m dbconn2sHl2dbcomm2dbre$d dbconn=<ew 0le>b7onnect on!"&ro% der=9 croso+t.Tet.0(->6.F.8S d$t$ so#rce=" ; ser%er.m$pp$th!"northw nd.mdb""" dbconn.0pen!" sHl="S-(-73 U CR09 c#stomers" dbcomm=<ew 0le>b7omm$nd!sHl2dbconn" dbre$d=dbcomm.-4ec#teRe$der!" c#stomers.>$t$So#rce=dbre$d c#stomers.>$t$6 nd!" dbre$d.7lose!" dbconn.7lose!" end s#b </scr pt> <html> <body> <+orm r#n$t="ser%er"> <$sp,Repe$ter d="c#stomers" r#n$t="ser%er"> <He$der3empl$te> <t$ble border="*" w dth="*88%"> <tr> <th>7omp$nyn$me</th> <th>7ont$ctn$me</th> <th>/ddress</th> <th>7 ty</th> </tr> </He$der3empl$te> <:tem3empl$te> <tr> <td><%Q7ont$ ner.>$t$:tem!"comp$nyn$me""%></td> <td><%Q7ont$ ner.>$t$:tem!"cont$ctn$me""%></td> <td><%Q7ont$ ner.>$t$:tem!"$ddress""%></td> <td><%Q7ont$ ner.>$t$:tem!"c ty""%></td> </tr> </:tem3empl$te> <Cooter3empl$te> </t$ble> </Cooter3empl$te> </$sp,Repe$ter> </+orm> </body> </html>
dbre$d.7lose!" dbconn.7lose!"
We$ server controls are s)ecial "S+ .NET tags understood $y t'e server.
<$sp,control'n$me
We$ Server %ontrol 3d?otator Button 6alendar 6hec,Bo# 6hec,Bo#/ist +ataGrid +ata/ist +rop+own/ist 1'per/in, mage mageButton /a"el /in,Button /istBo# /iteral 2anel 2lace1older ?adioButton ?adioButton/ist ?epeater Ta"le Ta"le6ell Ta"le?ow Te#tBo# .ml
<$sp,control'n$me
)les
"S+. NET ;TM. %ontrols 1TM/3nchor 1TM/Button 1TM/ mage 1TM/ mage ( 1TM/ nput"utton 1TM/ nput6hec,"o# 1TM/ nput1idden 1TM/ nput mage 1TM/ nput?adio"utton 1TM/Ta"le 1TM/Ta"le ( 1TM/Te#tarea "S+. NET We$ %ontrols 3d?otator Button Button ( 6alendar 6alendar ( 6alendar B 6hec,"o# 6hec,"o#/ist +ata/ist +ata/ist with st'les +ata/ist with G3lternating temTemplateI +ropdown/ist 1'perlin, mage
mageButton /a"el /in,Button /ist"o# /iteral /iteral ( 2anel ?adio"utton ?adio"utton/ist ?epeater ?epeater with G3lternating temTemplateI ?epeater with GSeparatorTemplateI Ta"le Ta"le ( Te#t"o# Te#t"o# ( .M/ "S+. NET ,alidation %ontrols 6ompare9alidator 6ompare9alidator ( 6ustom9alidator ?ange9alidator ?ange9alidator ( ?egularE#pression9alidator ?e%uired5ield9alidator 9alidationsummar' 9alidationsummar' ( "S+. NET Events 2ageK/oad 2age. s2ostBac, "S+. NET &ata #inding 3rra'/ist ?adioButton/ist 3rra'/ist +rop+own/ist 1ashta"le ?adioButton/ist E 1ashta"le ?adio"utton/ist ( 1ashta"le +rop+own/ist Sorted/ist ?adioButton/ist E Sorted/ist ?adio"utton/ist ( Sorted/ist +rop+own/ist .M/ ?adio"utton/ist "S+. NET &ata$ase +ata"ase connection ! Bind to a ?epeater control +ata"ase connection ! Bind to a +ata/ist control