ASP.NET中正确显示>、<、>=、<=、<>等运算符
方法一:设定控件属性
如: <asp:BoundField DataField="nltj" HeaderText="年龄条件" SortExpression="nltj" HtmlEncode="False" />
方法二:编写代码:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowState == DataControlRowState.Alternate || e.Row.RowState == DataControlRowState.Normal)
{
e.Row.Cells[5].Text = Server.HtmlDecode(e.Row.Cells[5].Text);
}
}
}