110,538
社区成员
发帖
与我相关
我的任务
分享
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("ondblclick", "test("+e.Row.RowIndex+")");
}
}
<script type="text/javascript">
function test(no) {
var gv = document.getElementById("<%=GridView1.ClientID%>");
var rowStr = "";
var myRow = gv.rows(no+1);
for (var j = 0; j < myRow.cells.length; j++) {
rowStr += myRow.cells(j).innerText + "/";
}
alert(rowStr);
}
</script>
//设置SelectionMode属性 然后在dataGridView1_CellDoubleClick事件中取值e.RowIndex获取行
dataGridView.SelectionMode = FullRowSelect;