张三
C# asp.net gridview 单击/双击事件
if (e.Row.RowType == DataControlRowType.DataRow)
{
string url = "Page.aspx?ID=" + e.Row.Cells[1].Text;
//鼠标移动到每项时颜色交替效果
e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';this.style.color='#003399'");
e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#6699FF';this.style.color='#8C4510'");
//单击/双击 事件
e.Row.Attributes.Add("OnDblClick", "window.open('" + url + "','', 'alwaysRaised=1,dependent=1,resizable=0,scrollbars,width=500,height=300')");
//e.Row.Attributes.Add("OnDblClick", "DbClickEvent('" + e.Row.Cells[1].Text + "')");
//e.Row.Attributes.Add("OnClick", "ClickEvent('" + e.Row.Cells[1].Text + "')");
e.Row.Attributes.Add("OnClick", "javascirpt:__doPostBack('GridView1','Select$" + e.Row.RowIndex + "')");
e.Row.Attributes.Add("OnKeyDown", "GridViewItemKeyDownEvent('" + e.Row.Cells[1].Text + "')");
//设置悬浮鼠标指针形状为"小手"
e.Row.Attributes["style"] = "Cursor:hand";
}
现在我的希望的效果是单击选中行,双击打开窗口进行编辑.
问题来了,如果我在单击事件里处理,select$1 选中行的情况,那么双击打开窗口就变无效了.是什么原因造成的,有没有什么解决办法.(不好意思,只有10分了)
这是一篇来自百度知道的问题
本贴来自ZDNetChina中文社区 http://bbs.zdnet.com.cn ,本贴地址:http://bbs.zdnet.com.cn/viewthread.php?tid=546700

浙公网安备 33010602011771号