Visual C# Developer Center > Visual C# Forums > Visual C# General > Add Checkbox in gridview groupheader
Ask a questionAsk a question
 

AnswerAdd Checkbox in gridview groupheader

  • Saturday, November 07, 2009 1:00 PMRanjani Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Hi All,

    I have a gridview with groupheader containing checkbox. If i select the checkbox all the checkboxes in the group should be selected.

    Please find my code below.
     TableCell newCell = new TableCell();
                                newCell.ColumnSpan = this.gvTeamAssignmentList.Columns.Count;
                                newCell.BackColor = System.Drawing.Color.FromArgb(255, 248, 242);
                                newCell.ForeColor = System.Drawing.Color.Black;
                                newCell.Font.Bold = true;
                                newCell.Text = strTeamName;
                                //Creating Checkbox
                                CheckBox chk = new CheckBox();
                                chk.Text = strTeamName;
                                chk.CheckedChanged += new EventHandler(chk_CheckedChanged);
                                newCell.Controls.Add(chk);
    
    
                                groupHeaderRow.Cells.Add(newCell);
                                table.Controls.AddAt(realIndex, groupHeaderRow);
    
    Please tell me if i check the header checkbox how to check the values of the child checkboxes

Answers

All Replies