我试图将第一列元素设置为超链接重定向到另一个页面..但不知怎的,无论我尝试什么,它都不起作用。无法将列元素设置为超链接
reportTable.Rows[i].Cells[1].Text = report.reportId.ToString();
TableCell tCell = new TableCell();
tCell.Controls.Add(new LiteralControl(" report.reportId.ToString ()"));
// Create Hyperlink Web Server control and add to cell
System.Web.UI.WebControls.HyperLink h = new HyperLink();
h.Text = reportTable.Rows[i].Cells[1].Text = report.reportId.ToString();
h.NavigateUrl = "~/manage.aspx";
tCell.Controls.Add(h);
reportTable.Rows[i].Cells[2].Text = bench.mechId;
reportTable.Rows[i].Cells[3].Text = bench.elecId;
reportTable.Rows[i].Cells[4].Text = bench.name;
以何种方式是不工作?你有没有更多的代码来显示你在这张桌子上做什么,以及在哪里? – 2012-08-17 11:59:37
这有点奇怪'新的LiteralControl(“report.reportId.ToString()”)',你可以展开什么不工作? – V4Vendetta 2012-08-17 12:03:52
列元素没有被设置为超链接,尽管我已经将它们添加到了项目模板中。这是从数据源中获取reportid的。名称空间已经被编译并添加到引用程序集中。 – user1597398 2012-08-17 12:13:17