ASP .NET 2.0 and ASP .NET AJAX5108100011	– Hapsoro Adi P.5108100053	– Thaufan Ardi A.5108100099	– Jun Riandri
DEFINISIWeb application framework buatan MSASP -> Active Server Pages
KELEBIHANMudah digunakanLebih cepat dari PHPLanguage support (VB.NET, C#, etc)User friendlyMurah (free installation package)
How Active Server Pages WorkClient sends requestServer receives request and directs it to ASPASP processes, then returns result to clientHTTP request typesRequest methodsGETGets (retrieves) information from serverRetrieve HTML document or imagePOSTPosts (sends) data to serverSend info from HTML formClient-entered dataInfo to search InternetQuery for a databaseAuthentication info
How Active Server Pages WorkBrowsers often cache Web pagesCache: save on diskTypically do not cache POST responseNext POST request may not return same resultClient requests ASP fileParsed (top to bottom) by ActiveX component asp.dllActiveX component: server-side ActiveX control that usually does not have GUICode executed as encountered@LANGUAGE statementSpecifies scripting languageIf not used, VBScript assumedAs interpreted, HTML (plus client-side scripts) sent to clientParsed each time requestedWeb server must support ASP by providing component such as asp.dll
ASP .NET 2.0 & AJAXServer-side ActiveX ComponentsWeb controlsSession trackingCase studyAJAX
Server-side ActiveX ComponentsServer-side ActiveX componentsTypically do not have GUIIf scripting language for ASP not support certain feature, create ActiveX Server componentVisual C++, Visual Basic, Delphi, etc.Usually execute faster than scripting language equivalentsExecuted on serverClient does not need to support ActiveX technologies
WEB CONTROLSText controlsAdRotator controlsValidation controls
Text Control (1)<html><body><form runat="server">A basic TextBox:<asp:TextBox id="tb1" runat="server" /><br /><br />A password TextBox:<asp:TextBox id="tb2" TextMode="password" runat="server" /><br /><br />A TextBox with text:<asp:TextBox id="tb4" Text="Hello World!" runat="server" /><br /><br />A multiline TextBox:<asp:TextBox id="tb3" TextMode="multiline" runat="server" /><br /><br />A TextBox with height:<asp:TextBox id="tb6" rows="5" TextMode="multiline"runat="server" /><br /><br />A TextBox with width:<asp:TextBox id="tb5" columns="30" runat="server" /></form></body></html>
Text Controls (1)
Text Controls (2)
Text Controls (2)<script  runat="server">Sub submit(sender As Object, e As EventArgs)   lbl1.Text="Your name is " & txt1.TextEnd Sub</script><html><body><form runat="server">Enter your name:<asp:TextBox id="txt1" runat="server" /><asp:Button OnClick="submit" Text="Submit" runat="server" /><p><asp:Label id="lbl1" runat="server" /></p></form></body></html>
Image Controls
adRotator
Validation Controls (1)<script  runat="server">sub check_operator(sender As Object, e As EventArgs)    compval.Operator=CType(list.SelectedIndex,ValidationCompareOperator)   compval.Validate()end sub</script><html><body><form runat="server"><table border="0" bgcolor="#b0c4de">   <tr valign="top">     <td colspan="4"><h4>Compare two values</h4></td>   </tr>
Validation Controls (1)   <tr valign="top">     <td><asp:TextBox id="txt1" runat="server" /></td>     <td>     <asp:ListBox id="list" rows="2" OnSelectedIndexChanged="check_operator" runat="server">           <asp:ListItem value="Equal" selected>=</asp:ListItem>           <asp:ListItem value="NotEqual"><></asp:ListItem>     </asp:ListBox>     </td>     <td><asp:TextBox id="txt2" runat="server" /></td>     <td><asp:Button Text="Validate" runat="server" /></td>   </tr></table><br /><asp:CompareValidatorid="compval" Display="dynamic"ControlToValidate="txt1" ControlToCompare="txt2" ForeColor="red" BackColor="yellow" Type="String"EnableClientScript="false" Text="Validation Failed!" runat="server" /></form></body></html>
Validation Controls (1)
Session TrackingCookies
What is a Cookie?A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With ASP, you can both create and retrieve cookie values.
Accessing a Database from an Active Server PageASP can communicate with databasesVia ADO (ActiveX Data Objects)Three-tier distributed applicationsUser interfaceOften created using HTML, Dynamic HTML or XMLBusiness logicUse Web serversDatabase accessAll three tiers may reside on separate computers connected to a network
With database
	1	<% @LANGUAGE = VBScript %>	2	<%Option Explicit%>	3		4	<%' Fig. 26.16 : login.asp%>	5		6	<%	7	   ' Set up the variables for this page	8	Dim dbConn, dbQuery, loginRS, loginFound	9		10	   ' Check to see if there is an existing connection to	11	   ' the Database. If not, create one	12	IfIsObject( Session( "mothergoose_dbConn" ) ) Then	13	      Set dbConn = Session( "mothergoose_dbConn" )	14	Else	15	      Set dbConn = Server.CreateObject( "ADODB.Connection" )	16	      Call dbConn.Open( "mothergoose", "", "" )	17	      Set Session( "mothergoose_dbConn" ) = dbConn	18	End If	19		20	   ' Create the SQL query	21	   dbQuery = "SELECT * FROM users"	22		23	   ' Create the recordset	24	Set loginRS = Server.CreateObject( "ADODB.Recordset" )	25	Call loginRS.Open( dbQuery, dbConn )	26		27	 On Error Resume Next' If an error occurs, ignore it	28		29	   ' Move to the first record in the recordset	30	Call loginRS.MoveFirst()	31	%>	32	1.1	Test if session variable mothergoose_dbConn is storing an object
1.2	 If not, create an ADODB.Connection object to open a connection
1.3	 Create SQL query
1.4	 Create recordset33<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">34<HTML>35<HEAD><TITLE>Login Page</TITLE></HEAD>3637<BODY>38<!-- include header goes here--> 39<!-- #include virtual = "/includes/mgtheader.inc" -->4041<%42   ' If this is a return after a failed attempt, print an error43If Session( "loginFailure" ) = True Then%>44<FONT SIZE =4COLOR ="red"> Login attempt failed, 45please try again <P></FONT>46<%End If%>4748<%' Begin the form%>49<FONT FACE ="arial"SIZE =2>50Please select your name and enter 51your password to login:<BR>52</FONT>53<FORM NAME =sublogformACTION ="submitlogin.asp" METHOD =POST>5455<%' Format the form using a table%>56<TABLE BORDER = 0>57<TR>58<TD><FONT FACE ="arial"SIZE =2>Name:</FONT></TD>59<TD><SELECT NAME ="LOGINID">60<OPTION VALUE ="000">Select your name61<%62   ' Pull user names from the query to populate the dropdown63WhileNot loginRS.EOF641.5	 Test if session variable loginFailure is True
1.6	 Create dropdown menu from recordset65      ' If there is a session loginid, reuse it66If Session( "loginid" ) = loginRS( "loginid" ) Then67         loginFound = "selected "68End If6970      ' If a login cookie was found, reuse it71IfRequest.Cookies( "loginid" ) = loginRS( "loginid" ) Then72         loginfound = "selected "73End If7475      ' Create each dropdown entry %>76<OPTION<% =loginFound %>77VALUE = "<%=loginRS( "loginid" )%>">78<% =loginRS( "loginid" ) %>79<% loginfound = " " %>80<%81Call loginRS.MoveNext()82Wend83%>84</SELECT>85</TD>86</TR>8788<TR>89<TD><FONT FACE ="arial"SIZE ="2">Password:</FONT></TD>90<TD><INPUT TYPE ="password" NAME = "SUBMIT_LOGIN"></TD>91</TR>92<TR>93<TD>&nbsp;</TD>94<TD ALIGN ="LEFT"><INPUT TYPE = "submit" VALUE ="Log Me In" 95ID ="login1"NAME ="login1"></TD>96</TR>1.7	 Test for session loginid and loginid cookie (written by submitlogin.asp)	97	</TABLE>	98	</FORM>	99	</FONT>	100		101	<!-- #include virtual = "/includes/mgtfooter.inc" -->	102		103	</BODY>	104		105	</HTML>
AJAXAJAX = Asynchronous JavaScript and XML.AJAX is based on JavaScript and HTTP requests.AJAX is not a new programming language, but a new way to use existing standards.AJAX is the art of trading data with a web server, and changing parts of a web page, without reloading the whole page.
Sejarah AJAXPadaawalnya ASP.NET AJAX diberinama Atlas.Dirilispadatahun 2005 dalambentuk CTPs (Community Tkenis Previews)ASP.NET AJAX 1.0 RTM dirilis 23 januari 2007 sebagaitembahan ASP.NET 2.0
Browser supportIE (>= 6.0)Mozilla Firefox (>= 1.5)Opera (>= 9.0)Apple Safari (>= 2.0)Google Chrome
Arsitektur ASP.NET AJAXASP.NET AJAX merupakan framework ygterdiridaripusaka script client dankomponen server ygterintegrasi.Komponen server ASP.NET AJAX terdiridarikontrol – kontrol web server ASP.NET dan komponen2 untungmengatur UI danaluraplikasi, validasi, control server, dansebagainya.
Control serverContoh control server ASP.NET AJAX ygseringdigunakan :- ScriptManager- UpdatePanel- UpdateProgress- Timer

Presentasi Kelompok 25 PW A+B

  • 1.
    ASP .NET 2.0and ASP .NET AJAX5108100011 – Hapsoro Adi P.5108100053 – Thaufan Ardi A.5108100099 – Jun Riandri
  • 2.
    DEFINISIWeb application frameworkbuatan MSASP -> Active Server Pages
  • 3.
    KELEBIHANMudah digunakanLebih cepatdari PHPLanguage support (VB.NET, C#, etc)User friendlyMurah (free installation package)
  • 4.
    How Active ServerPages WorkClient sends requestServer receives request and directs it to ASPASP processes, then returns result to clientHTTP request typesRequest methodsGETGets (retrieves) information from serverRetrieve HTML document or imagePOSTPosts (sends) data to serverSend info from HTML formClient-entered dataInfo to search InternetQuery for a databaseAuthentication info
  • 5.
    How Active ServerPages WorkBrowsers often cache Web pagesCache: save on diskTypically do not cache POST responseNext POST request may not return same resultClient requests ASP fileParsed (top to bottom) by ActiveX component asp.dllActiveX component: server-side ActiveX control that usually does not have GUICode executed as encountered@LANGUAGE statementSpecifies scripting languageIf not used, VBScript assumedAs interpreted, HTML (plus client-side scripts) sent to clientParsed each time requestedWeb server must support ASP by providing component such as asp.dll
  • 6.
    ASP .NET 2.0& AJAXServer-side ActiveX ComponentsWeb controlsSession trackingCase studyAJAX
  • 7.
    Server-side ActiveX ComponentsServer-sideActiveX componentsTypically do not have GUIIf scripting language for ASP not support certain feature, create ActiveX Server componentVisual C++, Visual Basic, Delphi, etc.Usually execute faster than scripting language equivalentsExecuted on serverClient does not need to support ActiveX technologies
  • 8.
    WEB CONTROLSText controlsAdRotatorcontrolsValidation controls
  • 9.
    Text Control (1)<html><body><formrunat="server">A basic TextBox:<asp:TextBox id="tb1" runat="server" /><br /><br />A password TextBox:<asp:TextBox id="tb2" TextMode="password" runat="server" /><br /><br />A TextBox with text:<asp:TextBox id="tb4" Text="Hello World!" runat="server" /><br /><br />A multiline TextBox:<asp:TextBox id="tb3" TextMode="multiline" runat="server" /><br /><br />A TextBox with height:<asp:TextBox id="tb6" rows="5" TextMode="multiline"runat="server" /><br /><br />A TextBox with width:<asp:TextBox id="tb5" columns="30" runat="server" /></form></body></html>
  • 10.
  • 11.
  • 12.
    Text Controls (2)<script runat="server">Sub submit(sender As Object, e As EventArgs)   lbl1.Text="Your name is " & txt1.TextEnd Sub</script><html><body><form runat="server">Enter your name:<asp:TextBox id="txt1" runat="server" /><asp:Button OnClick="submit" Text="Submit" runat="server" /><p><asp:Label id="lbl1" runat="server" /></p></form></body></html>
  • 13.
  • 14.
  • 15.
    Validation Controls (1)<script runat="server">sub check_operator(sender As Object, e As EventArgs)    compval.Operator=CType(list.SelectedIndex,ValidationCompareOperator)   compval.Validate()end sub</script><html><body><form runat="server"><table border="0" bgcolor="#b0c4de">   <tr valign="top">     <td colspan="4"><h4>Compare two values</h4></td>   </tr>
  • 16.
    Validation Controls (1)  <tr valign="top">     <td><asp:TextBox id="txt1" runat="server" /></td>     <td>     <asp:ListBox id="list" rows="2" OnSelectedIndexChanged="check_operator" runat="server">           <asp:ListItem value="Equal" selected>=</asp:ListItem>           <asp:ListItem value="NotEqual"><></asp:ListItem>     </asp:ListBox>     </td>     <td><asp:TextBox id="txt2" runat="server" /></td>     <td><asp:Button Text="Validate" runat="server" /></td>   </tr></table><br /><asp:CompareValidatorid="compval" Display="dynamic"ControlToValidate="txt1" ControlToCompare="txt2" ForeColor="red" BackColor="yellow" Type="String"EnableClientScript="false" Text="Validation Failed!" runat="server" /></form></body></html>
  • 17.
  • 18.
  • 19.
    What is aCookie?A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With ASP, you can both create and retrieve cookie values.
  • 20.
    Accessing a Databasefrom an Active Server PageASP can communicate with databasesVia ADO (ActiveX Data Objects)Three-tier distributed applicationsUser interfaceOften created using HTML, Dynamic HTML or XMLBusiness logicUse Web serversDatabase accessAll three tiers may reside on separate computers connected to a network
  • 21.
  • 22.
    1 <% @LANGUAGE =VBScript %> 2 <%Option Explicit%> 3 4 <%' Fig. 26.16 : login.asp%> 5 6 <% 7 ' Set up the variables for this page 8 Dim dbConn, dbQuery, loginRS, loginFound 9 10 ' Check to see if there is an existing connection to 11 ' the Database. If not, create one 12 IfIsObject( Session( "mothergoose_dbConn" ) ) Then 13 Set dbConn = Session( "mothergoose_dbConn" ) 14 Else 15 Set dbConn = Server.CreateObject( "ADODB.Connection" ) 16 Call dbConn.Open( "mothergoose", "", "" ) 17 Set Session( "mothergoose_dbConn" ) = dbConn 18 End If 19 20 ' Create the SQL query 21 dbQuery = "SELECT * FROM users" 22 23 ' Create the recordset 24 Set loginRS = Server.CreateObject( "ADODB.Recordset" ) 25 Call loginRS.Open( dbQuery, dbConn ) 26 27 On Error Resume Next' If an error occurs, ignore it 28 29 ' Move to the first record in the recordset 30 Call loginRS.MoveFirst() 31 %> 32 1.1 Test if session variable mothergoose_dbConn is storing an object
  • 23.
    1.2 If not,create an ADODB.Connection object to open a connection
  • 24.
  • 25.
    1.4 Create recordset33<!DOCTYPEHTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">34<HTML>35<HEAD><TITLE>Login Page</TITLE></HEAD>3637<BODY>38<!-- include header goes here--> 39<!-- #include virtual = "/includes/mgtheader.inc" -->4041<%42 ' If this is a return after a failed attempt, print an error43If Session( "loginFailure" ) = True Then%>44<FONT SIZE =4COLOR ="red"> Login attempt failed, 45please try again <P></FONT>46<%End If%>4748<%' Begin the form%>49<FONT FACE ="arial"SIZE =2>50Please select your name and enter 51your password to login:<BR>52</FONT>53<FORM NAME =sublogformACTION ="submitlogin.asp" METHOD =POST>5455<%' Format the form using a table%>56<TABLE BORDER = 0>57<TR>58<TD><FONT FACE ="arial"SIZE =2>Name:</FONT></TD>59<TD><SELECT NAME ="LOGINID">60<OPTION VALUE ="000">Select your name61<%62 ' Pull user names from the query to populate the dropdown63WhileNot loginRS.EOF641.5 Test if session variable loginFailure is True
  • 26.
    1.6 Create dropdownmenu from recordset65 ' If there is a session loginid, reuse it66If Session( "loginid" ) = loginRS( "loginid" ) Then67 loginFound = "selected "68End If6970 ' If a login cookie was found, reuse it71IfRequest.Cookies( "loginid" ) = loginRS( "loginid" ) Then72 loginfound = "selected "73End If7475 ' Create each dropdown entry %>76<OPTION<% =loginFound %>77VALUE = "<%=loginRS( "loginid" )%>">78<% =loginRS( "loginid" ) %>79<% loginfound = " " %>80<%81Call loginRS.MoveNext()82Wend83%>84</SELECT>85</TD>86</TR>8788<TR>89<TD><FONT FACE ="arial"SIZE ="2">Password:</FONT></TD>90<TD><INPUT TYPE ="password" NAME = "SUBMIT_LOGIN"></TD>91</TR>92<TR>93<TD>&nbsp;</TD>94<TD ALIGN ="LEFT"><INPUT TYPE = "submit" VALUE ="Log Me In" 95ID ="login1"NAME ="login1"></TD>96</TR>1.7 Test for session loginid and loginid cookie (written by submitlogin.asp) 97 </TABLE> 98 </FORM> 99 </FONT> 100 101 <!-- #include virtual = "/includes/mgtfooter.inc" --> 102 103 </BODY> 104 105 </HTML>
  • 27.
    AJAXAJAX = AsynchronousJavaScript and XML.AJAX is based on JavaScript and HTTP requests.AJAX is not a new programming language, but a new way to use existing standards.AJAX is the art of trading data with a web server, and changing parts of a web page, without reloading the whole page.
  • 28.
    Sejarah AJAXPadaawalnya ASP.NETAJAX diberinama Atlas.Dirilispadatahun 2005 dalambentuk CTPs (Community Tkenis Previews)ASP.NET AJAX 1.0 RTM dirilis 23 januari 2007 sebagaitembahan ASP.NET 2.0
  • 29.
    Browser supportIE (>=6.0)Mozilla Firefox (>= 1.5)Opera (>= 9.0)Apple Safari (>= 2.0)Google Chrome
  • 30.
    Arsitektur ASP.NET AJAXASP.NETAJAX merupakan framework ygterdiridaripusaka script client dankomponen server ygterintegrasi.Komponen server ASP.NET AJAX terdiridarikontrol – kontrol web server ASP.NET dan komponen2 untungmengatur UI danaluraplikasi, validasi, control server, dansebagainya.
  • 31.
    Control serverContoh controlserver ASP.NET AJAX ygseringdigunakan :- ScriptManager- UpdatePanel- UpdateProgress- Timer
  • 32.

Editor's Notes

  • #3 ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft&apos;s Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language. The ASP.NET SOAP extension framework allows ASP.NET components to process SOAP messages.
  • #8 ActiveX is a framework for defining reusable software components that perform a particular function or a set of functions in Microsoft Windows in a way that is independent of the programming language used to implement them. A software application can then be composed from one or more of these components in order to provide its functionality
  • #11 &lt;html&gt;&lt;body&gt;&lt;form runat=&quot;server&quot;&gt;A basic TextBox:&lt;asp:TextBox id=&quot;tb1&quot; runat=&quot;server&quot; /&gt;&lt;br /&gt;&lt;br /&gt;A password TextBox:&lt;asp:TextBox id=&quot;tb2&quot; TextMode=&quot;password&quot; runat=&quot;server&quot; /&gt;&lt;br /&gt;&lt;br /&gt;A TextBox with text:&lt;asp:TextBox id=&quot;tb4&quot; Text=&quot;Hello World!&quot; runat=&quot;server&quot; /&gt;&lt;br /&gt;&lt;br /&gt;A multiline TextBox:&lt;asp:TextBox id=&quot;tb3&quot; TextMode=&quot;multiline&quot; runat=&quot;server&quot; /&gt;&lt;br /&gt;&lt;br /&gt;A TextBox with height:&lt;asp:TextBox id=&quot;tb6&quot; rows=&quot;5&quot; TextMode=&quot;multiline&quot;runat=&quot;server&quot; /&gt;&lt;br /&gt;&lt;br /&gt;A TextBox with width:&lt;asp:TextBox id=&quot;tb5&quot; columns=&quot;30&quot; runat=&quot;server&quot; /&gt;&lt;/form&gt;&lt;/body&gt;&lt;/html&gt;
  • #12 &lt;script  runat=&quot;server&quot;&gt;Sub submit(sender As Object, e As EventArgs)   lbl1.Text=&quot;Your name is &quot; &amp; txt1.TextEnd Sub&lt;/script&gt;&lt;html&gt;&lt;body&gt;&lt;form runat=&quot;server&quot;&gt;Enter your name:&lt;asp:TextBox id=&quot;txt1&quot; runat=&quot;server&quot; /&gt;&lt;asp:Button OnClick=&quot;submit&quot; Text=&quot;Submit&quot; runat=&quot;server&quot; /&gt;&lt;p&gt;&lt;asp:Label id=&quot;lbl1&quot; runat=&quot;server&quot; /&gt;&lt;/p&gt;&lt;/form&gt;&lt;/body&gt;&lt;/html&gt;
  • #14 &lt;html&gt;&lt;body&gt;&lt;form runat=&quot;server&quot;&gt;&lt;asp:Imagerunat=&quot;server&quot;AlternateText=&quot;W3Schools&quot;ImageUrl=&quot;/banners/w6.gif&quot;/&gt;&lt;/form&gt;&lt;/body&gt;&lt;/html&gt;
  • #15 &lt;script  runat=&quot;server&quot;&gt;   Sub change_url(sender As Object, e As AdCreatedEventArgs)      e.NavigateUrl=&quot;http://www.w3schools.com&quot;    End Sub &lt;/script&gt;&lt;html&gt;&lt;body&gt;&lt;form runat=&quot;server&quot;&gt;&lt;asp:AdRotator AdvertisementFile=&quot;Ad1.xml&quot;runat=&quot;server&quot; OnAdCreated=&quot;change_url&quot;target=&quot;_blank&quot; /&gt;&lt;/form&gt;&lt;p&gt;&lt;a href=&quot;ad1.xml&quot; target=&quot;_blank&quot;&gt;View XML file&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;
  • #18 &lt;script  runat=&quot;server&quot;&gt;sub check_operator(sender As Object, e As EventArgs)    compval.Operator=CType(list.SelectedIndex,ValidationCompareOperator)   compval.Validate()end sub&lt;/script&gt;&lt;html&gt;&lt;body&gt;&lt;form runat=&quot;server&quot;&gt;&lt;table border=&quot;0&quot; bgcolor=&quot;#b0c4de&quot;&gt;   &lt;tr valign=&quot;top&quot;&gt;     &lt;td colspan=&quot;4&quot;&gt;&lt;h4&gt;Compare two values&lt;/h4&gt;&lt;/td&gt;   &lt;/tr&gt;    &lt;tr valign=&quot;top&quot;&gt;     &lt;td&gt;&lt;asp:TextBox id=&quot;txt1&quot; runat=&quot;server&quot; /&gt;&lt;/td&gt;     &lt;td&gt;     &lt;asp:ListBox id=&quot;list&quot; rows=&quot;2&quot; OnSelectedIndexChanged=&quot;check_operator&quot; runat=&quot;server&quot;&gt;           &lt;asp:ListItem value=&quot;Equal&quot; selected&gt;=&lt;/asp:ListItem&gt;           &lt;asp:ListItem value=&quot;NotEqual&quot;&gt;&lt;&gt;&lt;/asp:ListItem&gt;     &lt;/asp:ListBox&gt;     &lt;/td&gt;     &lt;td&gt;&lt;asp:TextBox id=&quot;txt2&quot; runat=&quot;server&quot; /&gt;&lt;/td&gt;     &lt;td&gt;&lt;asp:Button Text=&quot;Validate&quot; runat=&quot;server&quot; /&gt;&lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;asp:CompareValidatorid=&quot;compval&quot; Display=&quot;dynamic&quot;ControlToValidate=&quot;txt1&quot; ControlToCompare=&quot;txt2&quot; ForeColor=&quot;red&quot; BackColor=&quot;yellow&quot; Type=&quot;String&quot;EnableClientScript=&quot;false&quot; Text=&quot;Validation Failed!&quot; runat=&quot;server&quot; /&gt;&lt;/form&gt;&lt;/body&gt;&lt;/html&gt;
  • #22 &lt;%@ Import Namespace=&quot;System.Data.OleDb&quot; %&gt;&lt;script  runat=&quot;server&quot;&gt;sub Page_Loaddim dbconn,sql,dbcomm,dbreaddbconn=New OleDbConnection(&quot;Provider=Microsoft.Jet.OLEDB.4.0;data source=&quot; &amp; server.mappath(&quot;/db/northwind.mdb&quot;))dbconn.Open()sql=&quot;SELECT * FROM customers&quot;dbcomm=New OleDbCommand(sql,dbconn)dbread=dbcomm.ExecuteReader()customers.DataSource=dbreadcustomers.DataBind()dbread.Close()dbconn.Close()end sub&lt;/script&gt;&lt;html&gt;&lt;body&gt;&lt;form runat=&quot;server&quot;&gt;&lt;asp:DataListid=&quot;customers&quot;runat=&quot;server&quot;cellpadding=&quot;2&quot;cellspacing=&quot;2&quot;borderstyle=&quot;inset&quot;backcolor=&quot;#e8e8e8&quot;width=&quot;100%&quot;headerstyle-font-name=&quot;Verdana&quot;headerstyle-font-size=&quot;12pt&quot;headerstyle-horizontalalign=&quot;center&quot;headerstyle-font-bold=&quot;True&quot;itemstyle-backcolor=&quot;#778899&quot;itemstyle-forecolor=&quot;#ffffff&quot;footerstyle-font-size=&quot;9pt&quot;footerstyle-font-italic=&quot;True&quot;&gt;&lt;HeaderTemplate&gt;Customers Table&lt;/HeaderTemplate&gt;&lt;ItemTemplate&gt;&lt;%#Container.DataItem(&quot;companyname&quot;)%&gt;  in&lt;%#Container.DataItem(&quot;address&quot;)%&gt;, &lt;%#Container.DataItem(&quot;city&quot;)%&gt;&lt;/ItemTemplate&gt;&lt;FooterTemplate&gt;Source: Northwind Database&lt;/FooterTemplate&gt;&lt;/asp:DataList&gt;&lt;/form&gt;&lt;/body&gt;&lt;/html&gt;
  • #31 ScriptManagerMengatursumberdaya script komponen-komponen client, merenderbagiandarihalaman, localization, globalization, dan custom user script. Script manager dibutuhkanolehUpdatePanel, UpdateProgressdankontrol Timer.UpdatePanelDigunakanuntukmembuat rendering sebagianhalaman (partial rendering), bukankeseluruhanhalaman.UpdateProgressMemberikaninformasimengenai status bagianhalaman yang ter-update dalamkontrolUpdatePanel.TimerMelakukanpostbackke server berdasarkan interval waktu yang telahditentukan. Kontrol Timer dapatdigunakanuntukmelakukanpostbackkeseluruhanhalamanatausebagaianhalaman yang adadalamUpdatePanel.
  • #32 &lt;html&gt;&lt;head&gt;&lt;script type=&quot;text/javascript&quot;&gt;function loadXMLDoc(url){if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;); }xmlhttp.open(&quot;GET&quot;,url,false);xmlhttp.send(null);document.getElementById(&apos;test&apos;).innerHTML=xmlhttp.responseText;}&lt;/script&gt;&lt;/head&gt;&lt;body&gt;&lt;div id=&quot;test&quot;&gt;&lt;h2&gt;Click to let AJAX change this text&lt;/h2&gt;&lt;/div&gt;&lt;button type=&quot;button&quot; onclick=&quot;loadXMLDoc(&apos;test1.txt&apos;)&quot;&gt;Click Me&lt;/button&gt;&lt;button type=&quot;button&quot; onclick=&quot;loadXMLDoc(&apos;test2.txt&apos;)&quot;&gt;Click Me&lt;/button&gt;&lt;/body&gt;&lt;/html&gt;