日期:2011-10-29  浏览次数:20480 次

在ItemDataBound事件里做

//假设第一列为超级链接列
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
    string ID = "123";
    string Name = "user";
    if ( ( e.Item.ItemType != ListItemType.Header ) && ( e.Item.ItemType != ListItemType.Footer ) )
    {
        e.Item.Cells[0].Text = "<a href=" + ( ( HyperLink ) e.Item.Cells[0].Controls[0] ).NavigateUrl + "&ID=" + ID + "&Name=" + Name + ">" + ( ( HyperLink ) e.Item.Cells[0].Controls[0] ).Text + "</a>";
    }
}