1 | 2010 Internetteknologi 2 (ITNET2) Kort teknisk ASP.NET introduktion Mandag den 4/ Jesper Tørresø
ASP.NET ”Programmørernes websider” Eller rettere ASP.NET er webapplikationer hvor brugergrænsefladen er distribueret ud i en browser og logik, databaser etc. ligger bag en webserver (en http server). ASP.NET stiller sammen med webserveren et applikations-framework til rådighed. Visual Studio 2010 stiller en IDE til rådighed for dette framework
Domænet
Domæner og klasser i frameworket ”Styre showet”
Application Framework
Kontrol og tilstand Adgang til ”kontrolklasser” (En kontrol ændre en tilstand) Eksempler: HttpRuntime, HttpApplication Adgang til ”tilstandsklasser”,her kan fx placeres data med forskelligt scope (Data er tilstand) Eksempler : Application Session Request ViewState !!Der er forskellige adgange i Frameworket til den samme information eksempel!! System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath; AppDomain.CurrentDomain.BaseDirectory
Page Life Cycle Step by Step Page Request Start Page initialization Load Validation Postback Event Handling Rendering Unload (View and Control state)
Events i en “Page Cyclus”
Afprøv eksempel Fra følgende links e_Life_Cycle_And_Events/Common_ASP_NET/Page_ Events Koden kan hentes på Campusnet
AutoEventWireup !!! AutoEventWireup="true" means that to wire up an event all you have to do is name the event in your.aspx page, like for a DropDownList: and in your code behind or in the script section: protected void ddl1_SelectedIndexChanged(object sender, EventArgs e) { } Without the autoeventwireup, you would have to subscribe to the event manually (wire up), for example, in your Page constructor: this.ddl1.SelectedIndexChanged += new EventHandler(ddl1_SelectedIndexChanged) So basically, the above line is done for you with AutoEventWireup="true" AutoPostBack="true" just means that when the textbox loses focus, if the contents have changed, the client's browser (thanks to javascript) will post the page. Above explanation from