2008年5月22日 星期四

在Asp.net中GridView相關處理

Blogger can't use asp.net tag
GridView id = GridView1
3 column

for (int i = 0; i < this.GridView1.Rows.Count; i++) {
GridViewRow gvr = GridView1.Rows[i];
CheckBox ckb = (CheckBox)gvr.FindControl("CheckBox1");
if (ckb.Checked == true)
{
ckb.Text.ToString();
gvr.Cells[2].Text ="Test"+ i;
//if a column is invisible ,it's text data will be null
}
else {
ckb.Text.ToString();
gvr.Cells[2].Text.ToString();
}
}

沒有留言: