gridview鼠标经过行换色,点击某一行获取当前行第一列的值,并将值传到另一个网页??请高位高手指教!!谢谢!!

cxlooing 2009-01-07 08:05:57
如题!!
...全文
216 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
cxlooing 2009-01-07
  • 打赏
  • 举报
回复
吴大侠,请问是分别在两个事件中加入上面的代码就可以了吗??谢谢!
homesos 2009-01-07
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wuyq11 的回复:]
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow) {
e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#cccccc'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e");
}
}
[/Quote]
换色,LS已经给出了。

在点击时获取值并传给另一个网页,需要在绑定gridview时,加入点击事件的javascript代码,如a href='跳转网址+第一列的值'></a>。
wuyq11 2009-01-07
  • 打赏
  • 举报
回复
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
Response.Redirect("A.aspx?a=" + GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].Text);

}
wuyq11 2009-01-07
  • 打赏
  • 举报
回复
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow) {
e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#cccccc'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e");
}
}

62,269

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧