如题我以前 自己用table 定制,刚接手了一个GridView,实在是玩不转。请教大家。代码如下。
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" CellPadding="4" ForeColor="#333333"  
        GridLines="None" PageSize="5" AutoGenerateColumns="False" 
         DataKeyNames="LeaveWordId" EnableSortingAndPagingCallbacks="True" 
                onpageindexchanging="GridView1_PageIndexChanging" onrowdeleting="GridView1_RowDeleting" 
        Width="100%">
        <PagerSettings Mode="NumericFirstLast" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" Height="25px" />
       
        <Columns >
            <asp:BoundField DataField="SubmitDatetime" HeaderText="SubmitDatetime" 
                SortExpression="SubmitDatetime" HeaderStyle-Width="180px"  
                HeaderStyle-BackColor="#e0e0e0" DataFormatString="{0:yyyy-MM-dd HH:mm:ss}">
<HeaderStyle BackColor="#E0E0E0" Width="180px"></HeaderStyle>
            </asp:BoundField>
            <asp:BoundField DataField="Content" HeaderText="Content" 
                SortExpression="Content" HeaderStyle-Width="300px"  
                HeaderStyle-BackColor="#e0e0e0" HeaderStyle-HorizontalAlign="Right">
            <HeaderStyle BackColor="#E0E0E0" Width="100px"></HeaderStyle>
<ItemStyle HorizontalAlign="Left" />
            </asp:BoundField>
            <asp:BoundField HeaderText="LeaveBy" DataField="LeaveBy" 
                SortExpression="LeaveBy" HeaderStyle-Width="100px"  
                HeaderStyle-BackColor="#e0e0e0" >
<HeaderStyle BackColor="#E0E0E0" Width="100px"></HeaderStyle>
            </asp:BoundField>
            <asp:BoundField HeaderText="IpSource" DataField="IpSource" 
                SortExpression="IpSource" HeaderStyle-Width="100px"  
                HeaderStyle-BackColor="#e0e0e0" >
<HeaderStyle BackColor="#E0E0E0" Width="100px"></HeaderStyle>
            </asp:BoundField>
            
            
            <asp:TemplateField HeaderText="Operation"  HeaderStyle-BackColor="#e0e0e0" HeaderStyle-Width="100px">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                        CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure to delete this item?');"></asp:LinkButton>
                </ItemTemplate><HeaderStyle BackColor="#E0E0E0" Width="100px"></HeaderStyle>
            </asp:TemplateField>
        </Columns>
        <PagerTemplate>
            <table width="100%" style="font-size:12px;">
        <tr>
        <td style="text-align: right">
            Page:<asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>'></asp:Label>
            /Total:<asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>'></asp:Label>&nbsp;&nbsp;
            <asp:LinkButton ID="btnFirst" runat="server" CausesValidation="False"
                CommandName="Page" Text="First" CommandArgument="first" OnClick="btnFirst_Click">
            </asp:LinkButton>&nbsp;&nbsp;|&nbsp;&nbsp;
            <asp:LinkButton ID="btnPrev" runat="server" CausesValidation="False"
                CommandName="Page" Text="Previous" CommandArgument="prev" onclick="btnFirst_Click">
            </asp:LinkButton>&nbsp;&nbsp;|&nbsp;&nbsp;
            <asp:LinkButton ID="btnNext" runat="server" CausesValidation="False"
                CommandName="Page" Text="Next" CommandArgument="next" OnClick="btnFirst_Click">
            </asp:LinkButton>&nbsp;&nbsp;|&nbsp;&nbsp;
            <asp:LinkButton ID="btnLast" runat="server" CausesValidation="False"
                CommandName="Page" Text="Last" CommandArgument="last" OnClick="btnFirst_Click">
            </asp:LinkButton>
            <asp:TextBox ID="txtNewPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>'
                Width="20px" AutoPostBack="True" 
                ontextchanged="txtNewPageIndex_TextChanged"></asp:TextBox>
            <asp:LinkButton ID="btnGo" runat="server" CausesValidation="False" CommandArgument="go"
                CommandName="Page" Text="GO" OnClick="btnFirst_Click"></asp:LinkButton>
        </td>
        </tr>
    </table>        </PagerTemplate>
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="Gray" HorizontalAlign="Center" BorderWidth="10px"/>
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#000000" Font-Bold="True" ForeColor="#333333" HorizontalAlign="right"/>
        <EditRowStyle BackColor="#999999" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>
            
        </ContentTemplate>
    </asp:UpdatePanel>