• 看看GridView的布局代码


    看看GridView的布局代码:

     
        <asp:GridView ID="gvStudent" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                                        EnableModelValidation="True" Font-Size="12pt" OnPageIndexChanging="gvStudent_PageIndexChanging"
                                        Width="100%" DataKeyNames="UserID" 
                                        OnSelectedIndexChanging="gvStudent_SelectedIndexChanging" Font-Names="宋体">
                                        <SelectedRowStyle Font-Bold="True" ForeColor="#CCFF99" BackColor="#009999"></SelectedRowStyle>
     
     
                                        <AlternatingRowStyle Font-Size="9pt" HorizontalAlign="Center" BackColor="#E8F4FF"></AlternatingRowStyle>
     
     
                                        <RowStyle Font-Size="9pt" HorizontalAlign="Center" ForeColor="#003399" BackColor="White"> </RowStyle>
     
                                        <HeaderStyle HorizontalAlign="Center" ForeColor="White" VerticalAlign="Middle" BackColor="#337FB2"> </HeaderStyle>
     
     
                                        <FooterStyle ForeColor="#003399" BackColor="#99CCCC"></FooterStyle>
                                        <Columns>
                                            <asp:BoundField DataField="UserID" HeaderText="学号" ReadOnly="True" />
                                            <asp:BoundField DataField="Pwd" HeaderText="密码" />
                                            <asp:BoundField DataField="UserName" HeaderText="学生姓名" />
                                            <asp:BoundField DataField="LoginTimes" HeaderText="考生登录次数" />
                                            <asp:TemplateField HeaderText="试卷提交状态">
                                                <ItemTemplate>
                                                    <asp:Label ID="Labeltatus" runat="server" Text='<%# Eval("Examstatus").ToString() == "1"?"已提交":"未提交"%>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="RemainTime" HeaderText="考生剩余时间" />
                                            <asp:TemplateField HeaderText="选 择" ShowHeader="False">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Select"
                                                        Text="选择"></asp:LinkButton>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
     
     
    重点关注红色部分的代码:这是对GridView样式设计及使用其关键作用的语句:
     
        分析:SelectedRowStyle ========》》使用 SelectedRowStyle 属性控制 GridView 控件中选中行的外观。
     
            AlternatingRowStyle========》》使用 AlternatingRowStyle 属性控制 GridView 控件中交替数据行的外观。
     
            RowStyle===============》》使用 RowStyle 属性控制 GridView 控件中数据行的外观。
     
            HeaderStyle============》》使用 HeaderStyle 属性控制 GridView 控件中标题行的外观。
     
            FooterStyle============》》使用 FooterStyle 属性控制 GridView 控件中脚注行的外观。
     
     
     
     
     
  • 相关阅读:
    (转)Python之路,Day6
    (转)函数作用域,匿名函数,函数式编程,面向过程,面向对象
    (转)面向对象编程初步
    day26-多态、封装、反射
    (转)面向对象进阶
    MySql-Mysql技术内幕~SQL编程学习笔记(1)
    Spring MVC-学习笔记(4)数据绑定流程
    Mybatis-学习笔记(10)调用存储过程、存储函数
    Mybatis-学习笔记(9)Mybatis3+spring4+springMVC
    Mybatis-学习笔记(8)常用的注解
  • 原文地址:https://www.cnblogs.com/xiaopanlyu/p/2568816.html
Copyright © 2020-2023  润新知