1
I’m working on a page that loads a list of items into a GridView. The content is being loaded normally, but the need to add a cell with a text and two buttons. With the code below is adding the elements, however the event click button is not working.
    protected void Grid_RowDataBound(object sender, GridViewRowEventArgs e)
    {
            if (e.Row.RowType != DataControlRowType.DataRow) return;
                e.Row.BackColor = System.Drawing.Color.Red;
                var btnEdit = new LinkButton
                {
                    Text = "Edit",
                };
                btnEdit.Click += btnEdit_Click;
                var btnRemove = new Button
                {
                    Text = "Remove",
                    ID = e.Row.Cells[1].Text
                };
                btnRemove.Click += btnRemove_Click;
                var chave = new Label
                {
                    Text = e.Row.Cells[1].Text
                };
                e.Row.Cells[1].Controls.Add(chave);
                e.Row.Cells[1].Controls.Add(btnRemove);
                e.Row.Cells[1].Controls.Add(btnXml);
            }
    private void btnEdit_Click(object sender, EventArgs e)
    {
    }
    private void btnRemove_Click(object sender, EventArgs e)
    {
    }