Vous êtes sur la page 1sur 25

Module 3

Creating a Microsoft ASP.NET Web Form

What Is a Web Form?


Web Forms are containers for the text and controls that you want to display in the browser Page directive and attributes
<%@ Page Title="" AutoEventWireup="true" Language="C#" CodeFile="Default.aspx.cs" Inherits="Default" %> <html> <body> <form id="form1" runat="server"> </form>

C# Web Form named Default.aspx HTML element Body element

Form element and attributes

</body>
</html>

How To Create a Web Form

Creating a new Web application or Web site

The default Web Form for a new project, Default.aspx, is automatically created

Adding additional Web Forms to an existing application

Use the Add New Item dialog box

What Is a Server Control?


Server controls run on the server and encapsulate user interface

Server Controls: Contain the runat="server" attribute Include buttons, text boxes, and lists

Save state to View state


Provide built-in functionality Use a common object model Create browser-specific HTML
The following is a code example of a Button Web server control
<asp:Button ID="Button1" runat="server" Text="Submit"/> ...renders as... <input id="Button1" type="submit" value="Submit" />

Types of Server Controls

HTML server controls

Web server controls

One-to-one mapping to HTML elements rendered

Standard controls Intrinsic controls Complex controls Data controls Data-bound controls Data source controls Validation controls Login controls Navigation controls

Basic Web Server Controls

Properties

AccessKey BorderStyle EnableViewState Page Text


Method

HasControls() ToString()
6

Basic Web Server Controls

Properties

Method

Event

AutoPostBack MaxLength TextMode Text

HasControls() ToString()

TextChange

Basic Web Server Controls

Properties

Event

AccessKey CausesValidation Enable Text

Click Command

Basic Web Server Controls

Properties

Method

AlternateText EnableViewState ImageAlign ImageUrl ToolTip

GetType() ToString()

Basic Web Server Controls

Properties

Method

Event

AlternateText EnableViewState ImageAlign ImageUrl OnClientClick

GetType() ToString()

Click Command

10

Basic Web Server Controls

Properties

Event

CausesValidation Enable Font PostBackUrl

Click Command

11

Basic Web Server Controls

Properties

Controls EnableViewState GroupingText HorizontalAlign Wrap

12

Selection Web Server Controls

Properties

Event

AutoPostBack Checked Text Width

CheckedChanged

13

Selection Web Server Controls

Properties

Event

AutoPostBack Checked GroupName Text

CheckedChanged

14

Selection Web Server Controls

Properties

Method

Event

AutoPostBack Items SelectedIndex SelectedValue Text

ClearSelection()

SelectedIndexChanged

15

Selection Web Server Controls

Properties

Method

Event

AutoPostBack Items SelectedIndex SelectedValue Text

ClearSelection()

SelectedIndexChanged TextChanged

16

Selection Web Server Controls

Properties

Method

Event

AutoPostBack ClearSelection() SelectedIndexChanged GetSelectionIndices() TextChanged Items SelectedIndex SelectedItem SelectionMode

17

Selection Web Server Controls

Properties

Method

Event

AutoPostBack Items SelectedIndex SelectedItem Text

ClearSelection() VerifyMultiSelect()

SelectedIndexChanged

18

Others Controls

Properties

Event

DayHeaderStyle DayNameFormat DayStyle SelectedDate SelectionMode TodaysDate

SelectionChanged VisibleMonthChanged DayRender

19

Other Controls

20

Other Controls

Properties

Method

Event

AdvertisementFile Equals() AlternateTextField Focus() ToString() ImageUrlField KeywordFilter NavigateUrlField

AdCreate

21

Request ,Response and Server Object

22

Request,Response and Server Object

23

Request,Responseand Server Object

24

Request,Responseand Server Object

25

Vous aimerez peut-être aussi