GridView在RowDataBound写,实现超链接,高手来教教我,怎么弄?!

解决方案 »

  1.   

    参考:(1)前台:<asp:HyperLink ID="hyperLink" runat="server" Text='<%# Eval("OperationFlag") %>' Target="_blank" ></asp:HyperLink>  后台绑定路径:  protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)  {  if (e.Row.RowType == DataControlRowType.DataRow)  {  HyperLink btnlink = (HyperLink)e.Row.Cells[3].FindControl("hyperLink");  HiddenField hidderid = (HiddenField)e.Row.Cells[3].FindControl("log_id");//通过隐藏域获取要传递的参数  string url = string.Empty;  if (hidderid != null)  {  url = "~/ImageManage/LogPicDetails.aspx?id=" + hidderid.Value;  btnlink.NavigateUrl = url;  }  }  }
      

  2.   

    if (e.Row.RowType == DataControlRowType.DataRow)
        {
          e.Row.Cells[0].Text = "<a href='xxx.aspx'>xxx</a>";
        }
      

  3.   


      e.Row.Cells[0].Text = "<a href='xxx.aspx'>"+e.Row.Cells[0].Text+"</a>";