ASP.NET Controls. Slide 2 Lecture Overview Identify the types of controls supported by ASP.NET and the differences between them.

Slides:



Advertisements
Similar presentations
Unit 02. ASP.NET Introduction HTML & Server controls Postbacks Page Lifecycle.
Advertisements

IT533 Lecture ASP.NET Controls. Installations Microsoft® SQL Server® 2008 Express.
Working with ASP Pages. Slide 2 The Tag (1) Remember that most ASP.NET pages contain a single tag with the runat attribute set It’s possible to have multiple.
Asp.NET Core Server Controls. Slide 2 Lecture Overview Understanding the types of ASP.NET controls HTML controls ASP.NET (Web) controls.
Anatomy of an ASP.NET Page. Slide 2 My Version of the Big Picture (1) ASP Worker (Engine) Your application Runs Server Other applications User 1User 2.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
COS 381 Day 23. © 2006 Pearson Addison-Wesley. All rights reserved Agenda Capstone progress report Overdue –Only received 1 out of 6 Capstone projects.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 3-1 of…
1 Chapter 20 — Creating Web Projects Microsoft Visual Basic.NET, Introduction to Programming.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
ASP.NET Programming with C# and SQL Server First Edition
CST JavaScript Validating Form Data with JavaScript.
Overview This presentation covers the initial overview of the different server controls. 2.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Chapter 3 Using Validation Controls. What is a Validation Control? A control that validates the value in another control Renders as an HTML tag with an.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
.Net is a collection of libraries, templates and services designed to make programming applications of all kinds, easier, more flexible (multi platform),
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 4-1 of…
JavaScript II ECT 270 Robin Burke. Outline JavaScript review Processing Syntax Events and event handling Form validation.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Lecture 11 – DOM Scripting SFDV3011 – Advanced Web Development Reference: 1.
ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
ASP.NET Web Server Controls Basic Web Server Controls.
Web Controls Chapter-7. Page  2 Synopsis  Stepping Up to Web controls  Basic Web control classes  Web control classes  Web control Base class  Units,
Chapter 4 – Working with ASP.NET Controls Dr. Stephanos Mavromoustakos.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Web Form Fundamentals Chapter-2 Unit-2.
© 2010 Delmar, Cengage Learning Chapter 8 Collecting Data with Forms.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Anatomy of an ASP.NET Page. Slide 2 Compiling an ASP.NET Page An ASP.NET page is compiled when it is rendered for the first time A page is compiled to.
Things like Textboxes, Lables, ‘n’at. ASPX page is not HTML Controls are rendered into markup that a browser can understand Some controls are rendered.
Module 1: Working with ASP.NET. Overview Introducing ASP.NET Creating Web Forms Adding ASP.NET Code to a Page Handling Page Events Discussion: ASP vs.
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
Chapter 4: Working with ASP.NET Server Controls OUTLINE  What ASP.NET Server Controls are  How the ASP.NET run time processes the server controls on.
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
The Problem of State. We will look at… Sometimes web development is just plain weird! Internet / World Wide Web Aspects of their operation The role of.
ASP.NET 4 Unleashed Chapter 1. .aspx page: contains C# script and HTML code including tags. Listing 1.1 FirstPage.aspx.
Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.
HTML FORMS The TEXT Object Presented By: Ankit Gupta.
Asp.NET Core Server Controls. Slide 2 Lecture Overview Understanding the types of ASP.NET controls HTML controls ASP.NET (Web) controls.
Overview of Previous Lesson(s) Over View  ASP is a technology that enables scripts in web pages to be executed by an Internet server.  ASP.NET is a.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
PostBack  When an initial request for a page (a Web Form) is received by ASP.NET, it locates and loads the requested Web Form (and if necessary compiles.
Event Handling & Viewstate CS 351 Ed Gellenbeck. Today Review of Web Forms ASP.NET Object Hierarchy Events State Management Page State Session State Application.
 ASP.NET provides an event based programming model that simplifies web programming  All GUI applications are incomplete without enabling actions  These.
ASP.NET Architecture Mike Taulty Developer & Platform Group Microsoft Ltd
1 Introducing Web Developer Tools Rapid application development tools ASP.NET-compatible web editors –Visual Studio.NET Professional Edition –Visual Studio.
XHTML Forms.
ASP.NET Forms.
Web Application Web Application are programs that can be executed either on a Web server or in a Web browser. An Online store accessed through a browser.
Web Forms, HTML, and ASP.NET
Chapter 8 User Controls.
Section 17.1 Section 17.2 Add an audio file using HTML
Web Development in Microsoft Visual Studio 2013
Anatomy of an ASP.NET Page
© 2015, Mike Murach & Associates, Inc.
Module 05: Building ASP .NET Applications
Web Development Using ASP .NET
Presentation transcript:

ASP.NET Controls

Slide 2 Lecture Overview Identify the types of controls supported by ASP.NET and the differences between them

Slide 3 Categorizing Controls There are two types of controls used in ASP.NET HTML controls are standard HTML controls understood by the browsers ASP.NET (Web) controls are processed by the server (IIS) and mapped to a complex array of HTML controls

Slide 4 HTML Controls Always map directly to HTML tags All attributes are strictly compatible with HTML They allow you to perform ‘some’ server side processing

Slide 5 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

Slide 6 Categorizing Server Controls ASP.NET CONTROLS HTML CONTROLS WEB CONTROLS

Slide 7 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)

Slide 8 Generalities HTML controls and Web controls can sometimes 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

Slide 9 ASP.NET Server Controls (1) These are unique to ASP.NET All are contained in the System.Web.UI.WebControls namespace All derive from WebControl runat=“server” attribute is required or the markup will be rendered verbatim The programming interface is intuitive and feels like attaching event handlers to desktop controls

Slide 10 ASP.NET Server Controls (2) Controls are objects having methods, properties and events Buttons are clicked SelectedIndexChanged fires for list boxes and combo boxes The wiring is a bit different

Slide 11 ASP.NET Server Controls (Event Wiring 1) ASP.NET Server controls have support events similar to their desktop countertops Names Match

Slide 12 ASP.NET Server Controls (Properties 1) ID – Name that will be used to reference the control instance programmatically (It’s the Name property that you are used to in VB) Page – Page object on which the control resides Parent – parent control instance Use for container controls Visible – Make the control instance visible or invisible EnableViewState defines whether contents are persisted through view state

Slide 13 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"

Slide 14 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

Slide 15 ASP.NET Server Controls (Events) Same page and control events discussed in the previous chapter Init – First step in the life cycle Load – occurs when the control is loaded into the page PreRender – fires just before the control is rendered Unload – control has been rendered. Use only to close files or release connections

Slide 16 Web Forms Controls (List) Buttons get clicked LinkButton and Button A menu does as the name implies A CheckBox gets checked You select items from a DropDownList The RadioButton allows us to select an item from a list of items

Slide 17 ASP Button and LinkButton Cause a post back by Handing the OnClick event Set the PostBackUrl to the desired page (URL) Handle the onCommand and use the value of the CommandName property Creates a multi-cast event handler

Slide 18 ASP Menu Create an outer element named Menu Inside the menu create an a list of Inside the list of create a list of Set the Text attribute to the visible menu item text Set the NavigateUrl attribute to the desired page

Slide 19 ASP Menu

Slide 20 ASP CheckBox Determine whether the box is check by reading the Checked property Set AutoPostBack to true to handle the onCheckedChanged event

Slide 21 ASP DropDownList

Slide 22 ASP RadioButton

Slide 23 Help Pages (Note)

Slide 24 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

Slide 25 HTML Controls (Interface) All HTML controls inherit from the HtmlControl class The properties are simple Attributes returns a collection of attribute / key value pairs Style gets a CSS collection of applied CSS properties Disabled indicates whether the control is disabled

Slide 26 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 Other – Other controls such as

Slide 27 HTML Control (Example) Mark a tag as a servers-side control Store the date as the control’s inner HTML

Slide 28

Slide 29 Using Server Controls with JavaScript So far, we have seen both client and server controls But how do we get client-side JavaScript into our ASP.NET pages and call that code from the client? Include client-side script into script blocks Create dynamically with RegisterClientScriptBlock and RegisterStartupScript As you will see, some controls rely on JavaScript to operate ( LinkButton ) ASP generates the code

Slide 30 RegisterClientScriptBlock Code is placed at the top of the page Thus, the code executes “before” the page has completely loaded Good to register functions but bad for referencing controls

Slide 31 RegisterStartupScript Code is placed at the end of the page Use when you want to reference other page controls Remember that HTML pages rendered and the DOM is processed sequentially

Slide 32 RegisterClientScriptInclude Again, the code appears at the beginning of the page Use to grab a bunch of JavaScript from a file

Slide 33 HTML Controls The HTMLAnchor class implements tags tags designated runat=“server” and having an id will be seen by the server

Slide 34 HTML Controls The href property contains the link Store the text in InnerHtml or InnerText BusinessNews.HRef= " BusinessNews.Title = Business news channel"; BusinessNews.InnerHtml = " BusinessNews ";

Slide 35 HTML Input Controls All input controls derive from HtmlInputControl Name is the read-only property containing the control name Type property mirrors the Type attribute Value contains text appearing in the control instance

Slide 36 The ServerChange event It fires for most HTML controls to denote that the control’s contents have changed from one postback to the next Use for check boxes, radio buttons, text boxes, etc.