Solved

Webpage reloads when paging gridview

Posted on 2006-11-26
2
384 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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 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