我们知道在VS2003甚至VS2005Beta下可以用DataFormatString格式化BoundField数据的输出:
               
VS2005下BoundField的DataFormatString不起作用了?<asp:BoundField HeaderText="DisplayText" DataField="FieldName" DataFormatString="{0:F2}">
VS2005下BoundField的DataFormatString不起作用了?    
<ItemStyle HorizontalAlign="Right" Width="60px"></ItemStyle>
VS2005下BoundField的DataFormatString不起作用了?    
<HeaderStyle HorizontalAlign="Right"></HeaderStyle>
VS2005下BoundField的DataFormatString不起作用了?
</asp:BoundField>

        但是,很快在VS2005中,你会发现DataFormatString不起作用了。

        这时候,应该同时设置HtmlEncode为false,DataFormatString才会起作用:
       
VS2005下BoundField的DataFormatString不起作用了?<asp:BoundField HeaderText="DisplayText" DataField="FieldName" DataFormatString="{0:F2}" HtmlEncode="false">
VS2005下BoundField的DataFormatString不起作用了?    
<ItemStyle HorizontalAlign="Right" Width="60px"></ItemStyle>
VS2005下BoundField的DataFormatString不起作用了?    
<HeaderStyle HorizontalAlign="Right"></HeaderStyle>
VS2005下BoundField的DataFormatString不起作用了?
</asp:BoundField>

相关文章:

  • 2021-09-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-22
  • 2021-06-04
  • 2022-12-23
相关资源
相似解决方案