Il miglior tutorial gestore eventi ASP.NET Nel 2024, in questo tutorial puoi imparare ASP.NET - gestore di eventi,Page_Load,Esempi,immobili Page.IsPostBack,Esempi,
È un gestore eventi per un dato evento per eseguire codice nella subroutine.
Si consideri il seguente codice:
Il codice di cui sopra verrà eseguito quando? La risposta è: "Non lo so itit"
Page_Load è uno dei tanti eventi ASP.NET comprensibili. Page_Load viene attivato quando la pagina viene caricata, ASP.NET chiamerà automaticamente il Page_Load subroutine, ed esegue il codice:
Nota: Page_Load non contiene riferimenti a oggetti o argomenti dell'evento!
Page_Load subroutine viene eseguito quando la pagina viene caricata ogni volta. Se si desidera eseguire il codice Page Load subroutine quando la pagina viene caricata, è possibile utilizzare la proprietà Page.IsPostBack. . Se la proprietà Page.IsPostBack è impostata su false, la pagina viene caricata prima Se impostato a true, allora la pagina viene trasmessa al server (ad esempio, facendo clic sul pulsante nel modulo):
Gli esempi sopra riportati mostrano "La data e l'ora è itit" unico messaggio quando la pagina viene caricata prima. Quando l'utente fa clic sul pulsante Invia è la, presentare subroutine scriverà "Ciao Mondo!" Nella seconda etichetta, ma la data e l'ora della prima etichetta non cambieranno.