【Vegas原创】GridView设定DataFormatString属性失效的解决方法

2年前 (2022) 程序员胖胖胖虎阿
233 0 0

我给GridView控件的各个BoundField数据行设定了DataFormatString属性,但是没有任何效用。
解决方法:将BoundField数据行的HtmlEncode属性设定成False

      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None">
                
<Columns>
                    
<asp:BoundField DataField="item" HeaderText="职类"    />
                    
<asp:BoundField DataField="a" HeaderText="目标整合" DataFormatString="{0:F2}" HtmlEncode=false />
                    
<asp:BoundField DataField="b" HeaderText="团队领导" DataFormatString="{0:F2}" HtmlEncode=false />
                    
<asp:BoundField DataField="c" HeaderText="沟通协调"  DataFormatString="{0:F2}" HtmlEncode=false/>
                    
<asp:BoundField DataField="d" HeaderText="决策判断"  DataFormatString="{0:F2}" HtmlEncode=false/>
                    
<asp:BoundField DataField="e" HeaderText="人才发展" DataFormatString="{0:F2}" HtmlEncode=false />
                
</Columns>
                
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                
<RowStyle BackColor="#EFF3FB" />
                
<EditRowStyle BackColor="#2461BF" />
                
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                
<AlternatingRowStyle BackColor="White" />
            
</asp:GridView>

相关文章

暂无评论

暂无评论...