GridView中双击某一行时跳转到另外一个页面

GridView中可以这样写
protected void grvList_RowDataBound(object sender, GridViewRowEventArgs e)
  {
  if (e.Row.RowType == DataControlRowType.DataRow)
  {
  e.Row.Attributes.Add("onmouseover", "c=style.backgroundColor;style.backgroundColor='#add8e6'");
  e.Row.Attributes.Add("onmouseout", "style.backgroundColor=c");

  //double click
  string strId = grvList.DataKeys[e.Row.RowIndex].Value.ToString();
  e.Row.Attributes.Add("ondblclick", "location.href='test.aspx?Id=" + strId + "'");
  e.Row.Attributes["style"] = "Cursor:hand";
  }
  }

posted @ 2011-10-13 10:31  gaoxuzhao  阅读(1533)  评论(0编辑  收藏  举报