如何修改这条代码
cs文件里定义了一个label aa
aa.Text = " <a href=../aa/aaindex.aspx?val= " + username + "\ " target=main> " + "合理化建议 " + " </a> ";
当在页面中的表格里放入 <asp:label id= "aa " runat= "server "> </asp:label> ,主要是实现相当于 <a target“main” href=../aa/aaindex.aspx?val= "username " > 合理化建议 </a> 的html连接,但无法显示出连接标题“合理化建议”,请问如何修改?
------解决方案--------------------为什么用label呢,用asp:hyperlink 控件
------解决方案--------------------aa.Text = " <a target=main href=../aa/aaindex.aspx?val= " + username "> " + "合理化建议 " + " </a> ";
------解决方案--------------------如果用asp:hyperlink
<asp:HyperLink ID= "HyperLink1 " runat= "server "> </asp:HyperLink>
HyperLink1.NavigateUrl= "aa/aaindex.aspx?val= "username " ";
HyperLink1.Text= "合理化建议 ";
------解决方案--------------------实践通过:
Literal literal=new Literal();
literal.Text= " <a href= 'http://www.sina.com.cn '> 合理化建议 </a> ";
myTable.Rows[0].Cells[0].Controls.Add(literal);