html标记<变成<??
我在后台写的是“<”,然后把它输出到前台就变成"<"了~~这个问题怎么解决啊?
------解决方案--------------------绑定控件,设置HtmlEncode="false"即可
------解决方案--------------------
------解决方案--------------------<asp:BoundField HtmlEncode="false"
------解决方案--------------------server.htmldecode();
------解决方案--------------------
这样
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Text = Server.HtmlDecode(e.Row.Cells[0].Text);
}
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="formd1" runat="server">
<asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound">
</asp:GridView>
</form>
</body>
</html>