IT533 Lecture ASP.NET Controls. Installations Microsoft® SQL Server® 2008 Express.

Slides:



Advertisements
Similar presentations
Chapter 3 – Web Design Tables & Page Layout
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
Start menu -> all program -> Microsoft Visual SourceSafe-> Microsoft Visual Studio 2010 Click.
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
User Controls, Master Pages, GridView. Content User Controls Styles, Themes, Master Pages Working with Data GridView Muzaffer DOĞAN - Anadolu University2.
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
Asp.NET Core Server Controls. Slide 2 Lecture Overview Understanding the types of ASP.NET controls HTML controls ASP.NET (Web) controls.
XHTML1 Tables and Lists. XHTML2 Objectives In this chapter, you will: Create basic tables Structure tables Format tables Create lists.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 3-1 of…
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Database-Driven Web Sites, Second Edition1 Chapter 2 INTRODUCTION TO HTML.
Introduction to ASP.Net ISYS 350. ASP.NET ASP.NET is a server-side technology for creating dynamic web pages. ASP.NET allows you to use a selection of.
Tutorial 3: Adding and Formatting Text. 2 Objectives Session 3.1 Type text into a page Copy text from a document and paste it into a page Check for spelling.
Chapter 19 – Macromedia Dreamweaver MX 2004
ASP.NET Programming with C# and SQL Server First Edition
Chapter 4 Dreamweaver: Part II The Web Warrior Guide to Web Design Technologies.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Lesson 13: Building Web Forms Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver CS6.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
Web Technologies Website Development Trade & Industrial Education
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Introducing Web Controls Outline 29.1 Analyzing the.
Chapter 71 Building Data-Driven ASP.NET Applications Introduction to ASP.NET By Kathleen Kalata.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 4-1 of…
Creating a Web Site to Gather Data and Conduct Research.
Web Controls Dr. Awad Khalil Computer Science & Engineering Department AUC.
ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.
1 Macromedia Dreamweaver Outline Introduction Macromedia Dreamweaver Text Styles Images and Links Symbols and Lines Tables Forms Scripting in Dreamweaver.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
Website Development with Dreamweaver
ASP.NET Web Server Controls Basic Web Server Controls.
Section 4.1 Format HTML tags Identify HTML guidelines Section 4.2 Organize Web site files and folder Use a text editor Use HTML tags and attributes Create.
XP Dreamweaver 8.0 Tutorial 3 1 Adding Text and Formatting Text with CSS Styles.
Chapter 4 – Working with ASP.NET Controls Dr. Stephanos Mavromoustakos.
Microsoft Expression Web-Illustrated Unit I: Working with Tables.
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.
Microsoft Visual Basic 2008 CHAPTER SEVEN Creating Web Applications.
Session 1 SESSION 1 Working with Dreamweaver 8.0.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
Microsoft Visual Basic 2005 CHAPTER 7 Creating Web Applications.
Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2.
1 Chapter 12 – Web Applications 12.1 Programming for the Web, Part I 12.2 Programming for the Web, Part II 12.3 Using Databases in Web Programs.
XHTML 1.1  Derived from Standard Generalized Markup Language (SGML) of ISO  XHTML concerned primary with content rather than presentation and style 
Chapter 5 Quick Links Slide 2 Performance Objectives Understanding Framesets and Frames Creating Framesets and Frames Selecting Framesets and Frames Using.
4 Chapter Four Introduction to HTML. 4 Chapter Objectives Learn basic HTML commands Discover how to display graphic image objects in Web pages Create.
Week Developing Web Applications 12. Programming for the Web A Web Application Runs on a Web Server and Presents Its Content to the User Across a Network,
Tutorial 3 Adding and Formatting Text with CSS Styles.
Introduction to HTML. _______________________________________________________________________________________________________________ 2 Outline Key issues.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Bookstore Web Application: Client Tier Introducing Web Controls.
IT533 Lectures ASP.NET AJAX.
Chapter 27 Getting “Web-ified” (Web Applications) Clearly Visual Basic: Programming with Visual Basic nd Edition.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Web and Multimedia Development Copyright © Genetic Computer School 2007WM LESSON OVERVIEW  Use of Tables  Creating Tables  Try It – 1  Creating.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Chapter 10, Slide 1Starting Out with Visual Basic 3 rd Edition Chapter 11 Developing Web Applications.
ASP.NET Forms.
ASP.NET Web Controls.
3.01 Apply Controls Associated With Visual Studio Form
Developing Web Applications
ASP.NET Controls IT533 Lecture.
Using Cascading Style Sheets (CSS)
ASP.NET.
PART 2.
Web Development Using ASP .NET
Programming with Microsoft Visual Basic 2008 Fourth Edition
Presentation transcript:

IT533 Lecture ASP.NET Controls

Installations Microsoft® SQL Server® 2008 Express

Server Controls ASP.NET ships with ~50 built-in controls Organized into logical families HTML controls Controls / properties map 1:1 with HTML Web controls Richer functionality More consistent object model

Server Controls HTML Controls Works well with existing HTML designers Properties map 1:1 with HTML table.bgcolor ="red“; Can specify client-side event handlers Good when quickly converting existing pages Derived from System.Web.UI.HtmlControls.HtmlControl Supported controls have custom class, others derive from HtmlGenericControl

Server Controls HTML Controls Supported controls

Server Controls HTML Controls Demo 1: HTMLControls1.aspx Basic page lifecycle with HTML Controls Demo 2: HTMLControls2.aspx More HTML Controls

Server Controls HTML Controls Can use controls two ways: Handle everything in action events (e.g. button click) Event code will read the values of other controls (e.g. text, check boxes, radio buttons, select lists) Handle change events as well as action events

Server Controls Web Controls Consistent object model Label1.BackColor = Color.Red; Table.BackColor = Color.Blue;  Richer functionality E.g. AutoPostBack, additional methods  Strongly-typed; no generic control Enables better compiler type checking

Server Controls Web Controls Web controls appear in HTML markup as namespaced tags Web controls have an asp: prefix  Defined in the System.Web.UI.WebControls namespace  This namespace is automatically mapped to the asp: prefix

Server Controls Web Controls Web Controls provide extensive properties to control display and format, e.g. Font BackColor, ForeColor BorderColor, BorderStyle, BorderWidth Style, CssClass Height, Width Visible, Enabled

Server Controls Web Controls Four types of Web Controls Intrinsic controls List controls Rich controls Validation controls

Server Controls Intrinisic Controls Correspond to HTML controls Supported controls

Server Controls Intrinisic Controls TextBox, ListControl, CheckBox and their subclasses don’t automatically do a postback when their controls are changed Specify AutoPostBack=true to make change events cause a postback

Server Controls List Controls Controls that handle repetition Supported controls  Repeater, DataList and DataGrid controls expose templates for customization More about these controls and templates later

Server Controls CheckBoxList & RadioButtonList Provides a collection of check box or radio button controls Can be populated via data binding Item 1 Item 2 Item 3 Item 4 Item 5

Server Controls Intrinisic & Simple List Controls Demo 1: WebControls1.aspx Assorted intrinsic and list controls Demo 2: WebControls2.aspx Same controls with AutoPostBack

Image control TextBox control DropDownList control HyperLink control RadioButtonList Button control WebControls3 Example

We will generate this page by Visual Studio’s Design mode. Create an ASP.NET Web Site named WebControls3. Add an h3 heading element. Add an XHTML table element to organize the Image and TextBox controls in the user-information section of the page. Select Insert Table from the Table menu to display the Insert Table dialog In the Size group box, change the values of Rows and Columns to 2.

WebControls3 Example Change the vertical alignment of all cells in the table (i.e., td elements) by setting the valign property to top in the Properties window. Also change the width of the cells in the left column by modifying the style property in the Properties window. Click the ellipsis next to the style property to display the Modify Style dialog. Set the width (in the Position category) to 225px.

WebControls3 Example Add an Image control to insert an image. Add an Images folder to this project by right clicking the location of the project in the Solution Explorer and selecting New Folder. Then add each of the images used in the example to this folder by right clicking the folder and selecting Add Existing Item…. The ImageUrl property specifies the location of the image to display. To select an image, click the ellipsis next to the ImageUrl property and use the Select Image dialog. A TextBox control allows you to obtain text from the user and display text to the user.

WebControls3 Example A DropDownList does not allow users to type text. Each item in the drop-down list is defined by a ListItem element. You can add items to a DropDownList using the ListItem Collection Editor. This process is similar to customizing a ListBox in a Windows application. Visual Studio displays smart-tag menus for many ASP.NET controls to facilitate common tasks.

22 Add a HyperLink control. The Navigate­Url property of this control specifies the resource that is requested when a user clicks the hyperlink. Setting the Target property to _ blank specifies that the requested web page should open in a new window or tab. The RadioButtonList control provides a series of radio buttons from which the user can select only one. Like options in a DropDownList, individual radio buttons are defined by ListItem elements. A Button web control represents a button that triggers an action when clicked, and typically maps to an XHTML input element of type " button ". WebControls3 Example

23 CSS Inline Styles and Embedded Style Sheets Visual Web Developer often generates CSS (Cascading Style Sheets TM ) code to specify the presentation of an element. In the head element of your.aspx file, the style element defines embedded style sheets. The style element’s type attribute specifes the MIME type of its content. The body of the style sheet declares CSS rules (styles). A CSS rule is composed of a CSS selector and a series of property specifications separated by semicolons ( ; ) and enclosed in curly braces ( {} ). Each specification is composed of a property followed by a colon and a value. WebControls3 Example: CSS Styling

Setting the Color of Text on a Web Form Add CSS styles using Then apply the style in an XHTML span element using CSS styling. The style class can then be applied to any element in the document by setting the XHTML attribute class. Another way to apply styles is to use inline styles, which declare an individual element’s format using the XHTML attribute style.

Outline WebControls.aspx ( 1 of 6 ) Simple form for gathering user input Web Form that demonstrates web controls. (Part 1 of 6. ) In the head element of your.aspx file, the style element defines embedded style sheets.

Fig. | Web Form that demonstrates web controls. (Part 2 of 6. ) An Image control inserts an image into a web page. A TextBox control allows you to obtain text from the user and display text to the user. In the head element of your.aspx file, the style element defines embedded style sheets.

Fig. | Web Form that demonstrates web controls. (Part 4 of 6. ) The DropDownList control provides a list of values from which the user can select only one. The HyperLink control adds a hyperlink to a web page.

28 Fig. | Web Form that demonstrates web controls. (Part 5 of 6. ) The RadioButtonList control provides a series of radio buttons from which the user can select only one. A Button web control represents a button that triggers an action when clicked, and typically maps to an XHTML input element of type "button".

Server Controls Rich Controls Custom controls with rich functionality Supported Controls More will be added 3 rd party controls ( ) Demo: RichControls1.aspx

30 Outline FlagRotator.aspx (3 of 3 ) Fig. | Web Form that demonstrates the AdRotator web control. (Part 3 of 3. ) a) AlternateText displayed in a tool tip AdRotator image c) b)

AdRotator Example: FlagRotator Add an AdRotator control named countryRotator. Add a XmlDataSource control, which supplies the data to the AdRotator control. Figure (a) shows the first time the page is requested, when the Swedish flag is randomly chosen. In the second request, as shown in Figure (b), the French flag is displayed. Figure (c) depicts the web page that loads when you click the French flag.

AdRotator Example: FlagRotator Connecting Data to an AdRotator Control An XmlDataSource references an XML file containing data that will be used in an ASP.NET application. To build this example, we first add the XML file AdRotatorInformation.xml to the project. Right click the App_Data folder in the Solution Explorer and select Add Existing Item…. Next, drag an AdRotator control from the Toolbox to the Web Form.

AdRotator Example: FlagRotator From the smart-tag menu, select from the Choose Data Source drop-down list to start the Data Source Configuration Wizard. Select XML File as the data-source type. Set the ID of the control to adXmlDataSource. In the next dialog’s Data File section, click Browse… and, in the Select XML File dialog, locate and select the XML file you added to the App_Data folder.

AdRotator Example: FlagRotator Examining an XML File Containing Advertisement Information Any XML document used with an AdRotator control—must contain one Advertisements root element. Within that element can be as many Ad elements as you need. Each Ad element is similar to the following: Images/france.png the-world-factbook/geos/fr.html France Information 1

AdRotator Example: FlagRotator Element ImageUrl specifies the path (location) of the advertisement’s image. Element NavigateUrl specifies the URL for the web page that loads when a user clicks the advertisement. The AlternateText element nested in each Ad element contains text that displays in place of the image when the browser cannot display the image. The Impressions element specifies how often a particular image appears, relative to the other images. In our example, the advertisements display with equal probability, because the value of each Impressions element is set to 1.

Exercise