用超级链接列,然后在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>";
}
}

解决方案 »

  1.   

    可以直接在datagrid中修改属性,在超级连接列的
    url字段输入
    字段名称
    url格式字符串中输入
    webform2.aspx?字段名称={0}
    注意不要在上面留下空格要顶着写
    在webform2.aspx中page-load中加入以下语句
    string 变量名 = Request.QueryString.Get("字段名");
      

  2.   

    谢谢,你们上面说的我用过,但是我的问题关键是,要新打开一个窗口,所以需要用javascript onclick事件,这样的话,参数就不着怎么得不到了!  :(