GridView分页跳转到几页的功能不能实现。下面代码中txtNewPageIndex的值取得不对。ASPX 代码:            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnPageIndexChanging="GridView1_PageIndexChanging"
                OnPageIndexChanged="GridView1_PageIndexChanged" AllowPaging="true" PageSize="20"
                Height="117px" Width="800">
                <FooterStyle BackColor="#FFFFFF" Font-Bold="True" ForeColor="White" />
                <Columns>
                    <asp:TemplateField HeaderText="ID" ItemStyle-Width="50px">
                        <ItemTemplate>
                            <asp:Label ID="Labelid" runat="server" Text='<%# Bind("id") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="IP" ItemStyle-Width="250px">
                        <ItemTemplate>
                            <asp:Label ID="Labelip" runat="server" Text='<%# Eval("ip")+" / "+IPtoText(Eval("ip").ToString()) %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="类型" ItemStyle-Width="220px">
                        <ItemTemplate>
                            <asp:Label ID="Labeltypeid" runat="server" Text='<%# typeidtotext(Eval("typeid").ToString()) %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="操作" ItemStyle-Width="100px">
                        <ItemTemplate>
                            <!--<a style="color: #000;" href="javascript:Update(<%# Eval("id") %>)">修改</a>-->
                            <a style="color: #000;" href="EditLink.aspx?id=(<%# Eval("id") %>)">修改</a> <span
                                onclick="return window.confirm('你真要删除所选项?')"><a href="dellink.aspx?id=<%# Eval("id") %>"
                                    style="color: Black;">删除</a></span>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <RowStyle BackColor="#eef2ff" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                <PagerStyle BackColor="#7D9AFF" ForeColor="#333333" HorizontalAlign="Center" />
                <HeaderStyle BackColor="#7D9AFF" Font-Bold="True" ForeColor="White" Height="30" />
                <AlternatingRowStyle BackColor="White" />
                <PagerTemplate>
                    第<asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
                    共/<asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>' />页
                    <asp:LinkButton ID="lbnFirst" runat="Server" Text="首页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'
                        CommandName="Page" CommandArgument="First"></asp:LinkButton>
                    <asp:LinkButton ID="lbnPrev" runat="server" Text="上一页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'
                        CommandName="Page" CommandArgument="Prev"></asp:LinkButton>
                    <asp:LinkButton ID="lbnNext" runat="Server" Text="下一页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != (((GridView)Container.NamingContainer).PageCount - 1) %>'
                        CommandName="Page" CommandArgument="Next"></asp:LinkButton>
                    <asp:LinkButton ID="lbnLast" runat="Server" Text="尾页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != (((GridView)Container.NamingContainer).PageCount - 1) %>'
                        CommandName="Page" CommandArgument="Last"></asp:LinkButton>
                    跳到<asp:TextBox ID="txtNewPageIndex" runat="server" Width="20px" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />
                    <asp:LinkButton ID="btnGo" runat="server" CausesValidation="False" CommandArgument="-1" CommandName="Page" Text="GO" OnClick="Turn_Click" />
                        <asp:RegularExpressionValidator
                            ID="RegularExpressionValidatorSum" runat="server" ControlToValidate="txtNewPageIndex"
                            Display="Dynamic" ErrorMessage="RegularExpressionValidator" ValidationExpression="^[-]?(\d+\.?\d*|\.\d+)$">(必须为数字)</asp:RegularExpressionValidator>
                    <!-- here set the CommandArgument of the Go Button to '-1' as the flag -->
                </PagerTemplate>
            </asp:GridView>C#        protected void Turn_Click(object sender, EventArgs e)
        {            GridView1.PageIndex = int.Parse(((TextBox)GridView1.BottomPagerRow.FindControl("txtNewPageIndex")).Text) - 1;
            //GridView1.PageIndex = 5;
            BindData();
        }
((TextBox)GridView1.BottomPagerRow.FindControl("txtNewPageIndex")).Text) 这个值不正常,只能取到
<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %> 
这个的值,取不到自己输入的。谢谢。