需要在GridView中的某列根据内容判断,动态添加一个按钮,并为这个按钮添加事件,但总是不能成功
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
        if (e.Row.Cells[8].Text.ToString() == "用户订单已经关闭")
        {
          Label 标签 = new Label();
          标签.Text = "用户订单已经关闭";
          Button 恢复按钮 = new Button();
          恢复按钮.Text = "恢复订单";
          恢复按钮.Click += new EventHandler(恢复按钮_Click);
          e.Row.Cells[8].Controls.Add(标签);
          e.Row.Cells[8].Controls.Add(恢复按钮);
        }
      }
    }    private void 恢复按钮_Click(object sender, EventArgs e)
    {
      提示信息.Text = "测试";
      UpdatePanel2.Update();
    }