SlideShare uma empresa Scribd logo
1 de 31
ASP .NET 2.0 and ASP .NET AJAX 5108100011	– Hapsoro Adi P. 5108100053	– Thaufan Ardi A. 5108100099	– Jun Riandri
DEFINISI Web application framework buatan MS ASP -> Active Server Pages
KELEBIHAN Mudah digunakan Lebih cepat dari PHP Language support (VB.NET, C#, etc) User friendly Murah (free installation package)
How Active Server Pages Work Client sends request Server receives request and directs it to ASP ASP processes, then returns result to client HTTP request types Request methods GET Gets (retrieves) information from server Retrieve HTML document or image POST Posts (sends) data to server Send info from HTML form Client-entered data Info to search Internet Query for a database Authentication info
How Active Server Pages Work Browsers often cache Web pages Cache: save on disk Typically do not cache POST response Next POST request may not return same result Client requests ASP file Parsed (top to bottom) by ActiveX component asp.dll ActiveX component: server-side ActiveX control that usually does not have GUI Code executed as encountered @LANGUAGE statement Specifies scripting language If not used, VBScript assumed As interpreted, HTML (plus client-side scripts) sent to client Parsed each time requested Web server must support ASP by providing component such as asp.dll
ASP .NET 2.0 & AJAX Server-side ActiveX Components Web controls Session tracking Case study AJAX
Server-side ActiveX Components Server-side ActiveX components Typically do not have GUI If scripting language for ASP not support certain feature, create ActiveX Server component Visual C++, Visual Basic, Delphi, etc. Usually execute faster than scripting language equivalents Executed on server Client does not need to support ActiveX technologies
WEB CONTROLS Text controls AdRotator controls Validation 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 Tracking Cookies
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 Page ASP can communicate with databases Via ADO (ActiveX Data Objects) Three-tier distributed applications User interface Often created using HTML, Dynamic HTML or XML Business logic Use Web servers Database access All 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	 ,[object Object]
1.2	 If not, create an ADODB.Connection object to open a connection
1.3	 Create SQL query
1.4	 Create recordset,[object Object]
1.6	 Create dropdown menu from recordset,[object Object],[object Object]
AJAX AJAX = 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 AJAX Padaawalnya 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 support IE (>= 6.0) Mozilla Firefox (>= 1.5) Opera (>= 9.0) Apple Safari (>= 2.0) Google Chrome
Arsitektur ASP.NET AJAX ASP.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 server Contoh control server ASP.NET AJAX ygseringdigunakan : - ScriptManager - UpdatePanel - UpdateProgress - Timer

Mais conteúdo relacionado

Mais procurados

Cancer de-prostata-40601330[1]
Cancer de-prostata-40601330[1]Cancer de-prostata-40601330[1]
Cancer de-prostata-40601330[1]
Ludwing007
 
49368010 projectreportontraininganddevelopment(1)
49368010 projectreportontraininganddevelopment(1)49368010 projectreportontraininganddevelopment(1)
49368010 projectreportontraininganddevelopment(1)
Kritika910
 
計算機概論20161205
計算機概論20161205計算機概論20161205
計算機概論20161205
志宇 許
 

Mais procurados (9)

TYCS Ajax practicals sem VI
TYCS Ajax practicals sem VI TYCS Ajax practicals sem VI
TYCS Ajax practicals sem VI
 
HTML_HHC
HTML_HHCHTML_HHC
HTML_HHC
 
Synapse india basic php development part 2
Synapse india basic php development part 2Synapse india basic php development part 2
Synapse india basic php development part 2
 
Cancer de-prostata-40601330[1]
Cancer de-prostata-40601330[1]Cancer de-prostata-40601330[1]
Cancer de-prostata-40601330[1]
 
49368010 projectreportontraininganddevelopment(1)
49368010 projectreportontraininganddevelopment(1)49368010 projectreportontraininganddevelopment(1)
49368010 projectreportontraininganddevelopment(1)
 
Ubi comp27nov04
Ubi comp27nov04Ubi comp27nov04
Ubi comp27nov04
 
Javascript
JavascriptJavascript
Javascript
 
Database connectivity in PHP
Database connectivity in PHPDatabase connectivity in PHP
Database connectivity in PHP
 
計算機概論20161205
計算機概論20161205計算機概論20161205
計算機概論20161205
 

Destaque (7)

Aspects of usa[1][1]
Aspects of usa[1][1]Aspects of usa[1][1]
Aspects of usa[1][1]
 
Machinerieslunarweb
MachinerieslunarwebMachinerieslunarweb
Machinerieslunarweb
 
Alcohol
AlcoholAlcohol
Alcohol
 
Conjunctions htg
Conjunctions htgConjunctions htg
Conjunctions htg
 
Aspects of usa[1][1]
Aspects of usa[1][1]Aspects of usa[1][1]
Aspects of usa[1][1]
 
P.point blog
P.point blogP.point blog
P.point blog
 
Culture shock1
Culture shock1Culture shock1
Culture shock1
 

Semelhante a Tugas pw [kelompok 25]

Web Developement Workshop (Oct 2009) Slides
Web Developement Workshop (Oct 2009) SlidesWeb Developement Workshop (Oct 2009) Slides
Web Developement Workshop (Oct 2009) Slides
Manish Sinha
 
CIS 451: Introduction to ASP.NET
CIS 451: Introduction to ASP.NETCIS 451: Introduction to ASP.NET
CIS 451: Introduction to ASP.NET
webhostingguy
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter
nicdev
 
Apache Camel - WJax 2008
Apache Camel - WJax 2008Apache Camel - WJax 2008
Apache Camel - WJax 2008
inovex GmbH
 
Php Sessoins N Cookies
Php Sessoins N CookiesPhp Sessoins N Cookies
Php Sessoins N Cookies
mussawir20
 
Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8
Tatsuhiko Miyagawa
 

Semelhante a Tugas pw [kelompok 25] (20)

Boston Computing Review - Ruby on Rails
Boston Computing Review - Ruby on RailsBoston Computing Review - Ruby on Rails
Boston Computing Review - Ruby on Rails
 
Vb.Net Web Forms
Vb.Net  Web FormsVb.Net  Web Forms
Vb.Net Web Forms
 
Web Developement Workshop (Oct 2009) Slides
Web Developement Workshop (Oct 2009) SlidesWeb Developement Workshop (Oct 2009) Slides
Web Developement Workshop (Oct 2009) Slides
 
Component and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHPComponent and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHP
 
Struts2
Struts2Struts2
Struts2
 
More Asp
More AspMore Asp
More Asp
 
Implementation of GUI Framework part3
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3
 
Lecture3
Lecture3Lecture3
Lecture3
 
CIS 451: Introduction to ASP.NET
CIS 451: Introduction to ASP.NETCIS 451: Introduction to ASP.NET
CIS 451: Introduction to ASP.NET
 
Sencha Touch Intro
Sencha Touch IntroSencha Touch Intro
Sencha Touch Intro
 
Introduction To Lamp
Introduction To LampIntroduction To Lamp
Introduction To Lamp
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter
 
Jsp
JspJsp
Jsp
 
ASP.NET MVC
ASP.NET MVCASP.NET MVC
ASP.NET MVC
 
Hacking with YUI
Hacking with YUIHacking with YUI
Hacking with YUI
 
Apache Camel - WJax 2008
Apache Camel - WJax 2008Apache Camel - WJax 2008
Apache Camel - WJax 2008
 
ASP.Net, move data to and from a SQL Server Database
ASP.Net, move data to and from a SQL Server DatabaseASP.Net, move data to and from a SQL Server Database
ASP.Net, move data to and from a SQL Server Database
 
Php Sessoins N Cookies
Php Sessoins N CookiesPhp Sessoins N Cookies
Php Sessoins N Cookies
 
Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8
 
Aspdevice - Asp Fast Crud introdution
Aspdevice - Asp Fast Crud introdutionAspdevice - Asp Fast Crud introdution
Aspdevice - Asp Fast Crud introdution
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Tugas pw [kelompok 25]

  • 1. ASP .NET 2.0 and ASP .NET AJAX 5108100011 – Hapsoro Adi P. 5108100053 – Thaufan Ardi A. 5108100099 – Jun Riandri
  • 2. DEFINISI Web application framework buatan MS ASP -> Active Server Pages
  • 3. KELEBIHAN Mudah digunakan Lebih cepat dari PHP Language support (VB.NET, C#, etc) User friendly Murah (free installation package)
  • 4. How Active Server Pages Work Client sends request Server receives request and directs it to ASP ASP processes, then returns result to client HTTP request types Request methods GET Gets (retrieves) information from server Retrieve HTML document or image POST Posts (sends) data to server Send info from HTML form Client-entered data Info to search Internet Query for a database Authentication info
  • 5. How Active Server Pages Work Browsers often cache Web pages Cache: save on disk Typically do not cache POST response Next POST request may not return same result Client requests ASP file Parsed (top to bottom) by ActiveX component asp.dll ActiveX component: server-side ActiveX control that usually does not have GUI Code executed as encountered @LANGUAGE statement Specifies scripting language If not used, VBScript assumed As interpreted, HTML (plus client-side scripts) sent to client Parsed each time requested Web server must support ASP by providing component such as asp.dll
  • 6. ASP .NET 2.0 & AJAX Server-side ActiveX Components Web controls Session tracking Case study AJAX
  • 7. Server-side ActiveX Components Server-side ActiveX components Typically do not have GUI If scripting language for ASP not support certain feature, create ActiveX Server component Visual C++, Visual Basic, Delphi, etc. Usually execute faster than scripting language equivalents Executed on server Client does not need to support ActiveX technologies
  • 8. WEB CONTROLS Text controls AdRotator controls Validation controls
  • 9. 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>
  • 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>
  • 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>
  • 19. 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.
  • 20. Accessing a Database from an Active Server Page ASP can communicate with databases Via ADO (ActiveX Data Objects) Three-tier distributed applications User interface Often created using HTML, Dynamic HTML or XML Business logic Use Web servers Database access All three tiers may reside on separate computers connected to a network
  • 22.
  • 23. 1.2 If not, create an ADODB.Connection object to open a connection
  • 25.
  • 26.
  • 27. AJAX AJAX = 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.
  • 28. Sejarah AJAX Padaawalnya 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
  • 29. Browser support IE (>= 6.0) Mozilla Firefox (>= 1.5) Opera (>= 9.0) Apple Safari (>= 2.0) Google Chrome
  • 30. Arsitektur ASP.NET AJAX ASP.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.
  • 31. Control server Contoh control server ASP.NET AJAX ygseringdigunakan : - ScriptManager - UpdatePanel - UpdateProgress - Timer
  • 32. AJAX

Notas do Editor

  1. 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.
  2. 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
  3. &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;
  4. &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;
  5. &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;
  6. &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;
  7. &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;
  8. &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;
  9. 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.
  10. &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;