Saturday, June 4, 2011

ASP.NET Controls

Event Driven Programming

The flow of the program is determined by the event.
When an event occurs, the event is said to have been raised or fired.
Event Handler – An event contains the code that runs when an event is raised.
Dynamic web pages – Changes are made via user interaction
Dynamic Web Pages

Events can be processed on the client-side or the server side of the connection.
Client-side processing – code is executed on your computer (the client) and you see the results in the page you are viewing.
Server-side processing – code is executed on the server and the results are delivered to you as part of the html page you are viewing in your browser.
ASP.NET Events

Event handlers for .aspx pages are normally in code-behind(.vb/.cs) files associated with the page.
ASP.NET vs. classic ASP

classic ASP – mix of server-side code and HTML
1
&ltinput type=”text” value=”Time now <%=Time()%>”/&gt
ASP.NET controls live on the server-side in an ASPX page.
When the page is requested in the browser, the server side controls are processed by the ASP.Net runtime, client side HTML code is apended to the page containing the controls and then sent to the browser.
ASP.NET runtime is the engine that processes ASPX pages on the server.
1

ID – used to uniquely identify a control in a page.
runat=”server” – indicate that the control will be processed on the server.
Postback

When an event is triggered, the page is submitted back to the server for processing, along with information about the event and any pre-existing data on the page(via the ViewState property).
Allows our server code know which items within a drop-down list were selected, or what information a user types into a text box.
Standard or HTML Controls?

Server controls offer more functionality and better design-time support
HTML controls can be used when you don’t need the functionality of the server control.
Ajax (Asynchronous JavaScript And XML) Extensions

Combination of techniques that enable retrieving data from a web server without reloading the whole page.
Enable creation of flicker-free web applications.
WebParts

Allows the user to change the appearance and behaviour of the site.
Allows the user to rearrange content, hide or show parts, and add other content.
ASP.NET State Engine

Stateless HTTP protocol – the web server does not keep track of requests that have been made from a specific browser.
ASP.NET solves this problem by keeping track of the user’s actions via its State Engine.
State Engine remembers the state of the control via a property called ViewState
State Engine stores the current state of many controls at once.

No comments:

Post a Comment