Microsoft 开发人员网络 > 论坛主页 > Visual C# General > Add Checkbox in gridview groupheader
提出问题提出问题
 

已答复Add Checkbox in gridview groupheader

  • 2009年11月7日 13:00Ranjani 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     包含代码
    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

答案

全部回复