在BS中gridview 双击一行获取某一行的值,
在BS中gridview 双击一行获取这一行中的某一个值,--------------------编程问答-------------------- http://www.cnblogs.com/webabcd/archive/2007/01/22/626484.html
看看这个。 --------------------编程问答-------------------- 这个不行 --------------------编程问答--------------------
--------------------编程问答-------------------- 在GridView的RowDataBound事件中添加客户端双击事件,并将传递当前的行号:
//设置SelectionMode属性 然后在dataGridView1_CellDoubleClick事件中取值e.RowIndex获取行
dataGridView.SelectionMode = FullRowSelect;
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("ondblclick", "test("+e.Row.RowIndex+")");
}
}
js显示该行所有数据:
<script type="text/javascript">--------------------编程问答-------------------- RowDatabound事件里
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>
if( e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("OnDblClick", "DbClickEvent('" + e.Row.Cells[1].Text + "')");
e.Row.Attributes.Add("OnClick", "ClickEvent('" + e.Row.Cells[1].Text + "')");
}
function DbClickEvent(s)
{
}
补充:.NET技术 , C#