gridview中模版列里的控件不响应事件
模版列里的checkbox的CheckedChanged事件,DropdownList的SelectedIndexChanged事件等都进不去,就是Gridview中的所有模版列中的控件都不响应事件,而像buttonfield列就能响应click等,怎么回事?[此贴子已经被作者于2006-11-17 20:36:54编辑过]
这个是DataGrid的事件吧,我用的是GridView,我改成下面针对GridView(不知道改得对不对)的后还是不行
public void chk_CheckedChanged(object sender, System.EventArgs e)
{
CheckBox chk = this.GetHeaderCheckBox(this.GridView1);
foreach (GridViewRow i in this.GridView1.Rows)
{
CheckBox inChk = (CheckBox)i.Cells[0].Controls[1];
inChk.Checked = chk.Checked;
}
}
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType.ToString().Equals("Header"))
{
this.txt_code.Text = e.Row.RowType.ToString();
CheckBox chk = (CheckBox)e.Row.Cells[0].Controls[1];
chk.CheckedChanged += new EventHandler(chk_CheckedChanged);
}
}