您的位置:首页 > 其它

Selecting multiple checkboxes inside a GridView control - From CodeProject.com

2006-05-09 10:39 639 查看
Selecting multiple checkboxes inside a GridView control
By azamsharpThis article describes how you can select checkboxes inside a GridView control.

http://www.codeproject.com/aspnet/SelChkboxesDataGridView.asp

Code snippet:

// StringBuilder object
StringBuilder str = new StringBuilder();

// Select the checkboxes from the GridView control
for (int i = 0; i < GridView1.Rows.Count; i++)
{
GridViewRow row = GridView1.Rows[i];
bool isChecked = ((CheckBox) row.FindControl("chkSelect")).Checked;

if (isChecked)
{
// Column 2 is the name column
str.Append(GridView1.Rows[i].Cells[2].Text);
}
}

// prints out the result
Response.Write(str.ToString());
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐