Asp.net 如何在ASP的业务层中使文本具有标记

Asp.net 如何在ASP的业务层中使文本具有标记,asp.net,Asp.net,我希望数据表中的文本具有指向另一页的链接。我通过业务层来实现这一点 这是我的密码: DataTable reportTable=新的DataTable DataColumn colLeaveType = new DataColumn("leaveType", typeof(System.String)); DataColumn colNoDays = new DataColumn("No. of Days", typeof(System.Int32));

我希望数据表中的文本具有指向另一页的链接。我通过业务层来实现这一点

这是我的密码:

DataTable reportTable=新的DataTable

        DataColumn colLeaveType = new DataColumn("leaveType", typeof(System.String));
        DataColumn colNoDays = new DataColumn("No. of Days", typeof(System.Int32));
        DataColumn colStartDate = new DataColumn("Start Date", typeof(System.String));
        DataColumn colEndDate = new DataColumn("End Date", typeof(System.String));
        DataColumn colConvert = new DataColumn("Convert To Leave", typeof(System.String));


        reportTable.Columns.Add(colLeaveType);
        reportTable.Columns.Add(colNoDays);
        reportTable.Columns.Add(colStartDate);
        reportTable.Columns.Add(colEndDate);
        reportTable.Columns.Add(colConvert);

        reportTable.AcceptChanges();

        foreach (DataRow row in tempTable.Rows) {
            DataRow newRow = reportTable.NewRow();
            reportTable.Rows.Add(newRow);

            newRow[colLeaveType] = row["LeaveType"].ToString();
            newRow[colNoDays] = row["DaysCredit"].ToString();
            newRow[colStartDate] = row["StartDate"].ToString();
            newRow[colEndDate] = row["EndDate"].ToString();
            newRow[colConvert] = "Convert"; // this is something like this <a href="newPage"> Convert </a>

            reportTable.AcceptChanges();
        }
如何做到这一点?这可能吗

谢谢

RJUY


当然,在强制转换之前,您确实需要测试数据库中的值是否为null。使用StringBuilder生成链接也是最好的

它不起作用。我逐字显示课文。。为什么会这样?下面是代码newRow[colConvert]=;
newRow[colConvert] = "<a href='newPage'>" + row["Convert"].ToString() + "<a/>";