Unchecking CheckBox Placed in GridView's Header Template
I'm using a list view in which I have placed a grid view which contains a checkbox 开发者_开发知识库in the header template. Now if this checkbox is checked and I press the clear button then all the checkboxes in that column are unchecked, but that specific checkbox which is in the header is unchecked. What I want is that when the clear button is pressed, that checkbox also should be unchecked.
Just try this:
CheckBox cb2 = (CheckBox)Convert.ChangeType(
(GridView1.HeaderRow.FindControl("chk_select_all")),
typeof(CheckBox));
cb2.Checked = false;
精彩评论