codice:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="postback.aspx.vb" Inherits="CorsoApogeo_Chi_ha_effettuato_il_postback_postback" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Pagina senza titolo</title>
<link href="../../stili/Styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<h3>
Chi ha effettuato il PostBack?
<hr width="100%" size="1">
</h3>
<asp:Button ID="Button1" runat="server" Text="Button1"></asp:Button>
<asp:Button ID="Button2" runat="server" Text="Button2"></asp:Button>
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton1</asp:LinkButton>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="../../immagini/cestino.gif"></asp:ImageButton>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True"></asp:CheckBox>
<input type="submit" value="Submit" name="submit1" id="submit1">
</p>
<asp:Label ID="Label1" runat="server" EnableViewState="False"></asp:Label></p>
<asp:Label ID="Label2" runat="server" EnableViewState="False"></asp:Label></p>
<asp:Label ID="Label3" runat="server" EnableViewState="False"></asp:Label></p>
</form>
</body>
</html>
codice:
Option Strict On
Partial Class CorsoApogeo_Chi_ha_effettuato_il_postback_postback
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Inserire qui il codice utente necessario per inizializzare la pagina
Me.Label1.Text = Libreria.getForms
'PrintLn("Page_Load")
If Me.IsPostBack Then
If (Trim(Me.Request.Form("__EVENTTARGET")) <> "") Then
Me.Label2.Text = Trim(Me.Request.Form("__EVENTTARGET"))
End If
Dim wc As WebControl = DirectCast(Me.FindControl(Me.Label2.Text), WebControl)
If Not wc Is Nothing Then
Me.Label3.Text = Me.FindControl(Me.Label2.Text).GetType.ToString
End If
End If
End Sub
Public Overrides Sub RegisterRequiresRaiseEvent(ByVal control As System.Web.UI.IPostBackEventHandler)
'PrintLn("RegisterRequiresRaiseEvent")
MyBase.RegisterRequiresRaiseEvent(control)
Me.Label2.Text = DirectCast(control, WebControl).UniqueID
End Sub
End Class