日期:2014-05-17  浏览次数:20430 次

GridView中如何设置列表中的文字不加粗
GridView控件代码如下:
C# code
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" ForeColor="#333333" HorizontalAlign="Center" Width="100%" 
            BackColor="#CECECE" DataKeyNames="ID" onrowdeleting="gv_RowDeleting">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" 
                HorizontalAlign="Center" />
            <EditRowStyle BackColor="#999999" HorizontalAlign="Center" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="White" ForeColor="#333333" HorizontalAlign="Center" Font-Bold="false" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
            <Columns>
                <asp:BoundField DataField="LoginName" HeaderText="账  号" ItemStyle-Font-Bold="false"/>   
                <asp:BoundField DataField="UserName" HeaderText="姓  名"/>   
                <asp:CheckBoxField DataField="Visible" HeaderText="是否显示" />
                <asp:CheckBoxField DataField="Enabled" HeaderText="是否可用" />
                <asp:CommandField HeaderText="清空密码" SelectText="清空密码" ShowSelectButton="True" />
                <asp:CommandField DeleteText="删除账号" HeaderText="删除账号" ShowDeleteButton="True" />
            </Columns>        
          </asp:GridView>    



说明:
1、设置<RowStyle BackColor="White" ForeColor="#333333" HorizontalAlign="Center" Font-Bold="false" />中的Font-Bold="false"不起作用,需要单独设置每一列的 ItemStyle-Font-Bold="false"属性才可以,理应有个统一设置行样式的方式才对,经过测试发现只有字体加粗不可以,如果在RowStyle中设置了颜色的话整行都起作用



------解决方案--------------------
建议样式还是用样式文件写出来 也方便日后修改 汗 看着太乱`
------解决方案--------------------
看看其它地方还有没有引用什么样式文件
------解决方案--------------------
单独写一个css文件吧。
前台就是table