Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8280765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:47:59+00:00 2026-06-08T09:47:59+00:00

I have a gridview control, however, when I click the page number, I get

  • 0

I have a gridview control, however, when I click the page number, I get an error “Page not found”. What am I missing here?

My code is:

<asp:GridView ID="gvEmployeeResults" Width="900px" CellSpacing="1" 
    CellPadding="2"  
    AutoGenerateColumns="false" OnRowDataBound="gvEmployeeResults_OnRowDataBound" 
    runat="server" AllowPaging="true" >
    <Columns>
        <asp:TemplateField HeaderText="Last Name, First Name" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="left">
            <ItemTemplate>
                    <asp:LinkButton id="lbtnEmployeeName" OnCommand="EditEmployee_Command" CommandArgument='<%#Eval("EmployeeNum")%>' CommandName="EmployeeName" Visible="true" runat="server" ToolTip="Click to edit Employee."><%# DataBinder.Eval(Container.DataItem, "empLastName") + ", " + DataBinder.Eval(Container.DataItem, "empFirstName")%></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="empAddrLine1" ControlStyle-Width="225px" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="left" HeaderText="Address" />
        <asp:BoundField DataField="empCity" ControlStyle-Width="120px" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="left" HeaderText="City" />
        <asp:BoundField DataField="empState" ControlStyle-Width="50px" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="left" HeaderText="State" />
        <asp:BoundField DataField="empPostalCode" ControlStyle-Width="100px" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="left" HeaderText="Zip" />
        <asp:BoundField DataField="empDOB" ControlStyle-Width="100px" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="left" HeaderText="Date Of Birth" />
    </Columns>
</asp:GridView>


        protected void BindGridview()
        {
            corpEmployee.Employee emp = new corpEmployee.Employee();

            emp.empLastName = tboxLastName.Text.Trim();
            emp.empFirstName = tboxFirstName.Text.Trim();
            emp.empDOB = tboxDateOfBirth.Text.Trim();

            gvEmployeeResults.DataSource = corpEmployeeMgr.GetEmployees(emp);
            gvEmployeeResults.DataBind();
        }

        protected void gvEmployeeResults_OnRowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (e.Row.Cells[0].Text.Contains("nbsp;"))
                {
                    e.Row.Cells[0].Text = e.Row.Cells[0].Text.Replace("&lt;", "<").Replace("&gt;", ">").Replace("&amp;", "&");
                }
            }
            else
            {
                return;
            }
        }

        protected void gvEmployeeResults_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvEmployeeResults.PageIndex = e.NewPageIndex;
            gvEmployeeResults.DataBind();
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:48:01+00:00Added an answer on June 8, 2026 at 9:48 am

    you must use EnableViewstate= true and bind one time and use IsPostback. (PageIndex )

    1. EnableViewState=true for your control
    
    2. In the page load 
    
    If(! IspostBack )
    {
       Bind()....
    }
    
    And set PageIndex 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET page where I am showing products in a Gridview control.
I have a gridview control on my asp.net page(vb.net). I also have a cancel
I have two cascading dropdowns and one gridview control. on page load iam binding
Using asp.net 3.5 Gridview control, visual studio 2008. I have played with all the
I have a gridview. Here are my columns: The column choose's control is a
The Setup: I currently have a page with a GridView control on it inside
I have a ComboBox in a DataGridView . However I get an error when
I am looking to implement and learn more about the ASP.NET GridView control. However,
On my page I have the following Image control. <asp:Image ID=Image1 ImageUrl=~/images/icons/returnarrow.gif runat=server />
Have a gridview control which will show X amount of rows. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.