7. <html> <head> <title>HTML to Nowhere</title> </head> <body> <form> Please enter your name:<br/> <input type="text" name="username"/> <p/> Press the button to receive all of your hopes and dreams:<br/> <input type="submit" value="Dream Button" /> </form> </body> </html>
19. From Client Side to Server Side Browser ASPX file Server- Server executes code; results converted to HTML and returned to client Data reference to ASPX file Returns HTML Client Web Server Server-side script runat="server"
20.
21. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Dreamer.aspx.cs" Inherits="_Dreamer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Server Side Dreamer</title> </head> <body> <form id="form1" runat="server"> <div> Please enter your name:<br /> <asp:TextBox ID="DreamBox" runat="server"> </asp:TextBox> <p /> Press the button to receive all of your hopes and dreams:<br /> <asp:Button ID="Dreamer“ runat="server“ Text="Dream Button"OnClick="DoDream" /> <p /> <asp:Label ID="Dreams" runat="server" Text="Dreams Here"></asp:Label> </div> </form> </body> </html> Example of A Dynamic Website
22. using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Xml.Linq; public partial class _Dreamer : System.Web.UI.Page { protected void DoDream(object sender, EventArgs e) { Dreams.Text = DreamBox.Text + "'s dreams are big ones!"; } } Dreamer.aspx.cs