js 获取选中的checkbox的行的其他值
//aspx.cs
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
CheckBox chkSelect = (CheckBox)e.Row.FindControl( “chkSelect “);
chkSelect.Attributes.Add( “onclick “, “show ( \’ ” + e.Row.RowIndex + ” \’) “);
}
}
//aspx页添加脚本
function show(index)
{
var table = document.getElementById( “GridView1 “);
for(var i = 1; i < table.rows[0].cells.length; i++)
{
alert (table.rows[index + 1].cells[i].innerText);
}
return false;
}