用超级链接列,然后在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>";
}
}
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>";
}
}
解决方案 »
- FCKeditor:UserFilesPath
- gridview 绑定checkbox的问题
- 控件设计时问题
- 向 Http 输出流有几种方式? 在Xp-Sp2 不能用?
- 求救:一个不是问题的问题
- DataGrid或DataSet导出成的Excel表中的字段格式会变化,怎么修改??(跪求解决方法)
- 怎么在.net里写发email的程序?
- 请问ASP.net 安装程序如何 添加 4组序列号?
- 如何用C#写一个关闭页面?
- 如何引入命名空间?
- 生成数据集/架构失败,对存储过程未提供参数?
- 请问在visual studio.net下利用vb.net开发网站,程序员怎么样和设计人员结合起来工作,才能使做出来的东西和设计人员设计的效果一样呢?
url字段输入
字段名称
url格式字符串中输入
webform2.aspx?字段名称={0}
注意不要在上面留下空格要顶着写
在webform2.aspx中page-load中加入以下语句
string 变量名 = Request.QueryString.Get("字段名");