1 / 8

CIS 375—Web App Dev II

CIS 375—Web App Dev II. ASP .NET 4 Server Controls. Limitations in Classic ASP. <html> <body bgcolor="yellow"> <center> <h2>Hello W3Schools!</h2> <p> <%Response.Write(now())%> </p> </center> </body> </html>

reevesa
Download Presentation

CIS 375—Web App Dev II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CIS 375—Web App Dev II ASP .NET 4 Server Controls

  2. Limitations in Classic ASP <html> <body bgcolor="yellow"> <center> <h2>Hello W3Schools!</h2> <p> <%Response.Write(now())%> </p> </center> </body> </html> • A limitation in _______ ASP: The code block has to be placed where you want the output to appear. • With Classic ASP it is impossible to separate executable code from the ______ itself.

  3. Server Controls • ASP .NET has solved the “__________-code" problem described above with server controls. • Server controls are _____ that are understood by the server. • There are three kinds of server controls: • HTML Server Controls - Traditional HTML tags • _____ Server Controls - New ASP .NET tags • Validation Server Controls - For input validation

  4. HTML Server Controls 1 • HTML server controls are ______ tags understood by the server. • To make these elements a server control, add a runat="server" attribute to the HTML element. • The ___ attribute is added to identify the server control. • All HTML server controls must be within a _______ tag with the runat="server" attribute. • The Page_Load event is one of many events that ASP .NET understands.

  5. HTML Server Controls 2 • In the following example we declare an HtmlAnchor server control in an .aspx file. [Example] <script runat="server"> Sub Page_Load link1.HRef="http://www.w3schools.com" End Sub </script> <html> <body> <form runat="server"> <a id="link1" runat="server">Visit W3Schools!</a> </form> </body> </html>

  6. Web Server Controls • Web server controls are special ASP .NET tags understood by the server. [Example] <script runat="server"> Sub submit(Source As Object, e As EventArgs) button1.Text="You clicked me!" End Sub </script> <html> <body> <form runat="server"> <asp:Button id="button1" Text="Click me!" runat="server" OnClick="submit"/> </form> </body> </html>

  7. Validation Server Controls 1 • Validation server controls are used to validate user-input. • Each validation control performs a specific type of validation (like validating against a specific value or a range of values). • By default, page validation is performed when a Button, ImageButton, or LinkButton control is clicked. • You can prevent validation when a button control is clicked by setting the ________________ property to false.

  8. Validation Server Controls 2 [Example] <html> <body> <form runat="server"> Enter a number from 1 to 100: <asp:TextBox id="tbox1" runat="server" /> <br /><br /> <asp:Button Text="Submit" runat="server" /> <br /> <asp:RangeValidator ControlToValidate="tbox1" MinimumValue="1" MaximumValue="100" Type="Integer" EnableClientScript="false" Text="The value must be from 1 to 100!" runat="server" /> </form> </body> </html>

More Related