Solved

Webpage reloads when paging gridview

Posted on 2006-11-26
2
380 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
2 Comments
 
LVL 22

Accepted Solution

by:
scolja earned 300 total points
Comment Utility
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
Comment Utility
Thank you!
This was just what I needed.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now