如何在C#中动态打开新标签中的超链接

时间:2015-10-27 11:16:28

标签: c# asp.net

我想编写代码以在新选项卡中打开超链接在新选项卡中打开的属性是什么。如果我添加target = _blank给出错误

  firstCell.Controls.Add(new HyperLink { NavigateUrl = "~/TargetReportsDetails.aspx?cat=" + categoryname + "&LinkSubmtdDate=" + lnksubsndt + " &LinkSubmittedBy=" + LinkSubmittdBy + " ", Text = firstCell.Text});

1 个答案:

答案 0 :(得分:-1)

要从超链接打开新标签页,我们可以在C#中使用Target="_blank"

  firstCell.Controls.Add(new HyperLink { NavigateUrl = "~/TargetReportsDetails.aspx?cat=" + categoryname + "&LinkSubmtdDate=" + lnksubsndt + " &LinkSubmittedBy=" + LinkSubmittdBy + " ", Text = firstCell.Text,Target="_blank"});