Solved

Webpage reloads when paging gridview

Posted on 2006-11-26
2
383 Views
Last Modified: 2008-01-09
Hi Experts!

I have a gridview with paging.
The paging works fine, but when ever I page it seams like the complete webpage is reloaded.
This is not good since the gridview is located far down on my page, and the users needs to scroll down for each pageing.
Could someone tell me what I am doing wrong?

Here is my code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  If Not Page.IsPostBack Then
      loadGrid()
  End If
End Sub

Protected Sub ProductGrid_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles ProductGrid.PageIndexChanging
    ProductGrid.PageIndex = e.NewPageIndex
    loadGrid()
End Sub

GridView
########

<asp:GridView id="ProductGrid" Runat="Server" AllowPaging="True" PageSize="1"
      AutoGenerateColumns="False" PagerSettings-Position=Bottom PagerSettings-Mode=NextPrevious
      PagerSettings-FirstPageImageUrl="~/CommonFiles/Images/readMore.jpg"
      PagerSettings-PreviousPageImageUrl="~/CommonFiles/Images/readMore.jpg"
      PagerSettings-NextPageImageUrl="~/CommonFiles/Images/readMore.jpg"
      PagerSettings-LastPageImageUrl="~/CommonFiles/Images/readMore.jpg"
      PagerStyle-HorizontalAlign="Center" GridLines="None">
<Columns>
        <asp:TemplateField>
        <ItemTemplate>
...
0
Comment
Question by:gfk76
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
Jason Scolaro earned 300 total points
ID: 18015768
This is the default action of paging for a GridView, to cause a PostBack.  You can turn on a page directive to make the page stay at the last scroll position:

<%@ Page MaintainScrollPositionOnPostBack="true" />

http://msdn2.microsoft.com/en-us/library/system.web.ui.page.maintainscrollpositiononpostback(VS.80).aspx

-- Jason
0
 

Author Comment

by:gfk76
ID: 18017779
Thank you!
This was just what I needed.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question