Girdview 双击某一行怎么获取该行的Id Girdview 双击某一行怎么获取该行的Id??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("ondblclick", "test(" + e.Row.RowIndex.ToString() + ")"); } }js: function test(n) { alert(n);//获得点击的行数 } http://club.itqun.net/showtopic-78878.html protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("ondblclick", "test(" + ((Label)e.Row.FindControl("xxx")).Text + ")"); } }function test(n) { alert(n);//获得点击的行数 } 加个判断protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label l = e.Row.FindControl("对应绑定字段控件id") as Label; if(l != null) { e.Row.Attributes.Add("ondblclick", "test(" + l.Text + ")"); } } } 哦了 出来了,谢谢你 itliyi 我怎么就没想到判断呢,搞糊了现在唯一的缺陷就是 跳到指定的页面了 但是不是在 这个框架上了 是重新打开的,这个怎么解决 数据关系多对多值重复问题 ASP.NET(C#)的验证控件的一个小问题 GirdView问题 想做一个TELNET终端,WEB实现 请教:关于DataGrid的显示问题,HELP…… 求一算法(急) 我这样的学习方法对吗 50分求添加新记录不成功的原因! 如何找到用户控件中a标签,给a标签动态绑定一个后台事件? DataList中如何进行参数传递 生成.net项目的时候,报错了! 求.net验证控件 验证手机号
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("ondblclick", "test(" + e.Row.RowIndex.ToString() + ")");
}
}
js:
function test(n) {
alert(n);//获得点击的行数
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("ondblclick", "test(" + ((Label)e.Row.FindControl("xxx")).Text + ")");
}
}
function test(n) {
alert(n);//获得点击的行数
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label l = e.Row.FindControl("对应绑定字段控件id") as Label;
if(l != null)
{
e.Row.Attributes.Add("ondblclick", "test(" + l.Text + ")");
}
}
}
现在唯一的缺陷就是 跳到指定的页面了 但是不是在 这个框架上了 是重新打开的,这个怎么解决