TemplateField LinkField = new TemplateField();
LinkField.ItemTemplate = new LinkURL2();
LinkField.HeaderText = "详细信息";
LinkField.ItemStyle.CssClass = "GridViewItemStyle";
LinkField.HeaderStyle.CssClass = "GridViewHeader1";
LinkField.ItemStyle.Width = System.Convert.ToInt32("60");
LinkField.ItemStyle.VerticalAlign = VerticalAlign.Middle;
LinkField.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
DG_Main.Columns.Add(LinkField);
public class LinkURL2 : ITemplate
{
public void InstantiateIn(Control container)
{
Label LabLink = new Label();
LabLink.ID = "LabLink";
LabLink.Text = "详细内容";
container.Controls.Add(LabLink);
}
}
绑定连接列,看你是不是用动态的
把你绑的的内容直接付给一个linkbutton控件就可以了。控件可以指定地址的。