Solved

Webpage reloads when paging gridview

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

808 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