Reputation: 15
I've got this button (called "Accept") written in an action
protected TableRow AddLineToNotificationsPanel(string type,int UserCode)
{
TableRow NotificationTR = new TableRow();
TableCell AcceptTC = new TableCell();
Button Accept = new Button();
NotificationTR.Cells.Add(AcceptTC);
AcceptTC.Controls.Add(Accept);
Accept.Attributes.Add("OnClick", "check1");
return NotificationTR;
}
And this is the action "check1" (only built in order to check if the click is working).
protected void check1(object sender, EventArgs e)
{
Label1.Text = "TEXT CHANGED !";
}
Upon clicking on the button, the text on Label1 is not changed.
Any ideas why would it not work ? Thanks.
Upvotes: 0
Views: 564
Reputation: 588
You need to attach the event to this button. You can do it like that:
Accept.Click += new EventHandler(check1);
Upvotes: 1