הפעלת ארוע ב ASP.NET
אני מעוניין להפעיל ידנית את ארוע קליק של כפתור מסוים. כתבתי את הקוד הבא:
אני מעוניין להפעיל ידנית את ארוע קליק של כפתור מסוים. כתבתי את הקוד הבא:
public partial class Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { this.Button2.Click( sender, e); } protected void Button2_Click(object sender, EventArgs e) { Label1.Text = "Button2_Click"; } }
כמובן זו השורה החשובה.this.Button2.Click( sender, e);
אבל זה לא עובד. השגיאה היא Error 1 The event 'System.Web.UI.WebControls.Button.Click' can only appear on the left hand side of += or -= C:\Documents and Settings\tzvi\My Documents\Visual Studio 2005\WebSites\TargilTextBox\Default2.aspx.cs 20 22 C:\...\TargilTextBox\