• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/36

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

36 Cards in this Set

  • Front
  • Back
general page life-cycle stages
Page request

Start

Initialization

Load

Postback event handling

Rendering

Unload
life-cycle events of a page
PreInit

Init

InitComplete

PreLoad

Load

Control events

LoadComplete

PreRender

PreRenderComplete

SaveStateComplete

Render

Unload
PreInit page event
raised after the start stage is complete and before initialize stage begins (first event of the page)

use this event for the following:
1. check the isPostBack property to determine whether this is the first time the page is being processed
2. create or re-create dynamic controls
3. set a master page dynamically
4. set the Theme property dynamically
5. read or set profile property values

* if the request is a postback, the values of the controls have not yet been restored from the view state. If you set a control property at this stage, its value might be overwritten in the Init event
Init page event
raised after all controls have been initialized and any skin settings have been applied

the Init event of individual controls occurs before the Init event of the page, therefore, you can use this event to read or initialize control properties
InitComplete page event
raised at the end of the page's initialization stage

only one operation takes place between Init and InitComplete:
tracking of view state changes is turned on

use this event to make changes to view state that you want to make sure are persisted after the next postback
view state tracking
turned on between Init and InitComplete page events

enables controls to persist any values that are programmatically added to the ViewState collection

until view state tracking is turned on, any values added to view state are lost across postbacks

controls typically turn on view state tracking immediately after they raise their Init event
PreLoad page event
raised after the page loads view state for itself and all controls, and after it processes postback data that is included with the Request instance
Load page event
the Page object calls the OnLoad method on the Page object, and then recursively does the same for each child control until the page and all controls are loaded.

the Load event of individual controls occurs after the Load event of the page

use the OnLoad event method to set properties in controls and to establish database connections
OnLoad event method
use the OnLoad event method to set properties in controls and to establish database connections
control events
use these events to handle specific control events, such as a Button control's Click event or a TextBox control's TextChanged event
LoadComplete page event
raised at the end of the event-handling stage

use this event for tasks that require that all other controls on the page be loaded
PreRender page event
raised after the Page object has created all controls that are required in order to render the page, including child controls of composite controls

use this event to make final changes to the contents of the page or its controls before the rendering stage begins
PreRenderComplete page event
raised after each data bound control whose DataSourceID property is set calls its DataBind method
SaveStateComplete page event
raised after view state and control state have been saved for the page and for all controls

any changes to the page or controls at this point affect rendering, but the changes will not be retrieved on the next post back
Render page event
this is not an event - instead, at this stage of processing, the Page object calls this method on each control

all ASP.Net web server controls have a Render method that writes out the control's markup to send to the browser
Unload page event
raised for each control and then for the page

in controls, use this event to do final cleanup for specific controls, such as closing control-specific database connections

for the page itself, use this event to do final cleanup work, such as:
1. closing open files
2. closing open database connections
3. finishing up logging or other request-specific tasks
what are ASHX files
used to write custom httphandlers without the overhead of processing a page request (aspx file)

a placeholder for an HttpHandler which allows you to create an IHttpHandler implementation without any reconfiguration of web.config

it provides you access to the Request and Response without any of the facilities or overhead of the page model
what are HttpHandlers
low level implementations of the request/response http cycle

using an HttpHandler, you can deliver responses back to the browser with minimal overhead
how are HttpHandlers configured?
by registering them in web.config

you may also need to configure IIS to send certain file extension requests to aspnet_isapi.dll
what are some uses of a handler file (.ashx)
1. apply security mechanism
2. url rewriting
3. filter something in the request that is sent to IIS
data binding events for data-bound controls
1. Databinding

2. RowCreated (GridView only)
OR
ItemCreated (all other data controls)

3. RowDataBound (GridView only)
OR
ItemDataBound (all other data controls)

4. DataBound
DataBinding event for data-bound controls
raised after the control's PreRender event

this event marks the beginning of the process that binds the control to the data

USE: use this event to manually open database connections and to set parameter values dynamically before a query is run
RowCreated or ItemCreated event for data-bound controls
raised after the control's DataBinding event

USE: use this event to manipuluate content that is not dependent on data binding (i.e.: you might programmatically add formatting to a header or footer row in a GridView control)
RowDataBound or ItemDataBound event for data-bound controls
raised after the control's RowCreated or ItemCreated event

USE: when this event occurs, data is available in the row or item so you can format data or set the FilterExpression property on child data source controls
DataBound event for data-bound controls
raised at the end of data-binding operations in a data-bound control

USE: use this event to format data-bound content or to initiate data binding in other controls that depend on values from the current control's content
PostBack
the process of submitting an ASP.Net page to the server for processing (posting back to the server)

if a web page consists of one or more Web Controls configured to use AutoPostBack, the ASP.Net adds a special JavaScript function to the rendered HTML Page called _doPostBack()
How do I chain my own JavaScript into the client side without losing PostBack functionality?
you can use control events like OnClientClick to chain in your client side JavaScript, or you can use the GetPostBackEventReference method to give your scripts access to the postback method on the client side.
what is ViewState
the technique used by ASP.Net web pages to persist changes to the state of a Web Form across postbacks
where is view state stored?
by default it is placed in a hidden form field names __VIEWSTATE

the view state is serialized to the hidden form field and deserialized back on postback
what is the drawback of ViewState?
it is a hidden form filed which can easily get very larger causing slower downloads

whenever the user posts back the Web page, the contents of this hidden form field must be posted back in the HTTP request, thereby lengthening request time as well
What happens when an HTTP request is received on a TCP/IP port
when a web server receives a request, it examines the file name extension of the requested file, determines which ISAPI extension should handle the request and then passes the request to the appropriate ISAPI extension
what is ASP.Net?
an ISAPI extension under the Web server
How does IIS communicate with ASP.Net
When an aspx page is requested, IIS checks the file extension in its metabase.

aspx is mapped to aspnet_isapi.dll

When IIS find the extension aspx, then it loads the aspnet_isapi.dll and passes all the request details to it.

aspnet_isapi.dll then loads the CLR and passes all the request details that received.

CLR then create HttpRuntime engine.

The begining of the runtime engine is HttpRunTime class. It creates the HttpContext object and stores all the request details.

From there HttpContext object passes through a pipeline which consists of HttpApplication object, HttpModule objects and finally HttpHandler object.
HttpHandler object creates the html page.
what is an assembly binding redirect
you can redirect your app to use a different version of an assembly

how:
1. through a publisher policy
2. through an app configuration file
3. through a machine configuration file
compare LoadLibrary(), CreateObject() and Assembly.Load()
LoadLibrary() : loads the specified module into the address space of the calling process

CreateObject() : creates and returns a reference to an Automation object

Assembly.Load() : Loads an assembly
What is the OO relationship between an ASPX page and its CS/VB code behind file
inheritance
(the aspx simply inherits from the code behind class so that it can access protected methods)