【发布时间】:2020-06-21 18:30:21
【问题描述】:
我有这个按钮(称为“接受”)写在一个动作中
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;
}
这是动作“check1”(仅用于检查点击是否有效)。
protected void check1(object sender, EventArgs e)
{
Label1.Text = "TEXT CHANGED !";
}
点击按钮后,Label1 上的文字没有改变。
任何想法为什么它不起作用? 谢谢。
【问题讨论】:
标签: asp.net button onclick code-behind