首页 > 代码库 > GridView里做页面的链接

GridView里做页面的链接

采用Gridview的OnRowDataBound属性

后台

protected void gvTranslateInfo_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if(e.Row.RowIndex>=0)
            {
                if(e.Row.RowType==DataControlRowType.DataRow)
                {
                    e.Row.Cells[1].Text = "<a target=_blank href=http://www.mamicode.com/"http://wfweb.test.aspirecn.com/pzgl/page/WorkFlow/BBBY/BBBY_Default.aspx?sid=5&mid=184089&pid=" + e.Row.Cells[1].Text.ToString() + "&tid=5\">" + e.Row.Cells[1].Text.Replace("&amp;lt;", "<").Replace("&amp;gt;", ">") + "</a>";
                }
            }
        }