プログラムでチェックボックスを追加したグリッドビューがあります。foreachループ内にチェックボックスを作成するときは、次のようにして、チェックしたときにイベントをトリガーするようにします。
cbGV = new CheckBox();
cbGV.ID = "cbGV";
cbGV.AutoPostBack = true;
cbGV.CheckedChanged += new EventHandler(this.cbGV_CheckedChanged);
基本的に、イベントをトリガーしたいときは、以下のようにします。
protected void cbGV_CheckedChanged(object sender, EventArgs e)
{
//gets the current checked checkbox.
CheckBox activeCheckBox = sender as CheckBox;
foreach (GridViewRow gvr in GridView1.Rows)
{
//this code is for finding the checkboxes in the gridview.
CheckBox checkBox = ((CheckBox)gvr.FindControl("cbGV"));
//so basically, right here i'm confused on how i should compare the if/else logic, how i should compare and disable every other checkbox if the current checkbox is checked. Any ideas gues?
}
事前にご回答いただきありがとうございます。