Docsity

ASP Core Server Controls - Internet Programming - Lecture Slides, Slides of Computer Programming

Partial preview of the text

Download ASP Core Server Controls - Internet Programming - Lecture Slides and more Slides Computer Programming in PDF only on Docsity!

ASP.NET Controls

Lecture Overview

 Identify the types of controls supported by ASP.NET and the differences between them

HTML Controls

 Always map directly to HTML tags  All attributes are strictly compatible with HTML  They allow you to perform „some‟ server side processing

Web Server Controls

 Are implemented by the ASP server as .NET Framework classes having a common .NET programming interface  It works very similar to the desktop applications  Web Server controls often have a richer programming interface

The runat Attribute

 The runat attribute makes a server control a server control  This is true for both HTML and Web controls  All tags without the runat attribute are copied verbatim to the output stream (HTTP response)

 ****

Generalities

 HTML controls and Web controls can sometimes to do the same thing  HTML controls can be used to conditionally create client-side script  Web controls generally provide a „richer‟ programmatic interface  We often use a mix of both

ASP.NET Server Controls (2)

 Controls are object having methods, properties and events  Buttons are clicked  SelectedIndexChanged fires for list boxes and combo boxes  The wiring is a bit different

ASP.NET Server Controls

(Event Wiring 1)

 ASP.NET Server controls have support events similar to their desktop countertops

Names Match

ASP.Net Server Controls

(Properties 2)

 The Style property contains references to a collection of CSS style MyControl.Style[“border-color”] = blue;

 The CssClass property contains the name of a defined CSS class  txtStyleDemo1.CssClass = "TextBox"

ASP.NET Server Controls

(Methods)

Focus – sets input focus to the control instance when it is rendered  HasControls – denotes whether this control instance has child controls  Controls – a collection of child controls  DataBind – binds the control instance to a data source

Help Pages (Note)

HTML Controls (Overview)

 HTML controls are similar to ordinary HTML controls  However, with the runat=“server” attribute added  ASP.NET adds a programmatic way to interact with the control instances on the server

 ASP.NET controls are part of the System.Web.UI.HtmlControls namespace

HTML Controls (Categories)

HtmlInputControl – These represent the variations of the **** tag  HtmlContainerControl – These are Tables and other controls that contain other controls  See table 4-4 on page 113-  Other – Other controls such as ** **

HTML Control (Example)

 Mark a tag as a servers-side control

 Store the date as the control‟s inner HTML