public partial class _Default : System.Web.UI.Page{ public void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Button1.Click += Button1_Click; } } protected void Button1_Click(object sender, EventArgs e) { Button1.Click -= Button1_Click; Button1.Click += btnclick; } protected void btnclick(object sender, EventArgs e) { Label1.Text = "ll"; }}and here is it's source :<code><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click1" /></div> </form></body></html>
public partial class _Default : System.Web.UI.Page{ public void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Button1.Click -= Button1_Click; Button1.Click += btnclick; } protected void btnclick(object sender, EventArgs e) { Label1.Text = "worked"; }}