如果注意 是 单击行 而不是 单击行里的 某项另外  要求是 链接 <a href 地址>
马上给分

解决方案 »

  1.   


    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 
       { 
       
       e.Row.Attributes["onclick"] = String.Format("JavaScript:window.open({0})", "http://www.csdn.net"); 
         }  不知道你为什么非要<a href>? 单击行也只能是给这个row加上事件然后javascript去做.这个行本来不可能被<a >...</a>包含起来. 说白了给row加事件最终也只是给输入的table 的 row加上事件. 了解原理比实现功能更能提高自己.
      

  2.   

    同意楼上。 e.Row.Attributes["onclick"] = string.Format("window.open('{0}');", "http://www.csdn.net");
     e.Row.Attributes["onmouseover"] = "this.style.backgroundColor='Maroon';this.style.color='White';this.style.cursor='hand';";
     e.Row.Attributes["onmouseout"] = "this.style.backgroundColor='White';this.style.color='Black';"
      

  3.   

    另外最好是在
    if(e.Row.RowType==DataControlRowType.DataRow)
    {
       //在这里为行添加css属性。 
    }
      

  4.   

    只能是 ON CLICK 吗 那就是 不可能 链接了
      

  5.   

    要求是 使用 的最终效果是
    <a href ......>因为用的是 GreyBox 这个东西 好象一般是用 Href来触发
    不知道能不能实现 或是 通过别的办理, 触发 GreyBox
      

  6.   

    知道1楼的意思问题是 要用到 GreyBox
      

  7.   


    你要以在javascript里面写一个打开某一链接的函数,那样子可以用<a>...</a>包含,但是不支持这么做
      

  8.   

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 
       { 
       
       e.Row.Attributes["onclick"] = String.Format("JavaScript:location.href='http://www.csdn.net'); 
       } 
      

  9.   

    <asp:HyperLinkField DataNavigateUrlFields="detaineeId"  DataNavigateUrlFormatString="../InAndOutCalaboose/InCalabooseShow.aspx?Id={0}"
                    Text="查 看"/>加这句在gridview里面,哥子,思想太僵化了是卜行滴~~~,那个路径自己改哈要不就得这样,好像也可以
    protected void gdvComplice_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //如果是绑定数据行 
            if (e.Row.RowType == DataControlRowType.DataRow)
            {            
               e.Row.Attributes.Add("ondblclick", "window.location.href='InCalaboose.aspx?Id=" + this.gridInCalaBooseList.DataKeys[e.Row.RowIndex].Value + "'");
            }
        }
      

  10.   

    我要的链接是<a rel="gb_page_center[650,550]" title="公告通知" href="./WebForm/aaa.aspx?id=3635">那要 怎么办呢