Paging - Rows in first page also showing in second page: listitemcollectionposition

Hi,
I am trying to use the listitemcollectionposition to achieve paging. The pagination is shown, but some of the records in first page are getting displayed in second page as well.
I have totally 13 records in the list, and paging is applied for 10 items to show. I have set the rowcount to 10.
private void FillData(string pagingInfo)
int currentPage = Convert.ToInt32(ViewState["CurrentPage"]);
uint rowCount = 10; // Default of 10 items per page
string columnValue = string.Empty;
string nextPageString = "Paged=TRUE&p_ID={0}&p_";
string PreviousPageString = "Paged=TRUE&PagedPrev=TRUE&p_ID={0}&p_";
SPListItemCollection collection;
collection = GetTestItems(pagingInfo, rowCount);
public SPListItemCollection GetTestItems(string pagingInfo, uint rowLimit)
using (SPSite oSite = new SPSite(Sitename))
using (SPWeb oWeb = oSite.OpenWeb())
SPList lstPages = oWeb.Lists["Pages"];
SPQuery sQuery = new SPQuery();
SPListItemCollection collection;
sQuery.RowLimit = rowLimit;
sQuery.Query = "<Where>" +
"<And>" +
"<And>" +
"<Contains><FieldRef Name='PublishingPageLayout'/><Value Type='URL'>TC_NtestPageLayout.aspx</Value></Contains>" +
"<Eq><FieldRef Name='_ModerationStatus'/><Value Type='ModStat'>0</Value></Eq>" +
"</And>" +
"<Eq><FieldRef Name='_Level'/><Value Type='Integer'>1</Value></Eq>" +
"</And>" +
"</Where><OrderBy><FieldRef Name='TestLayoutDate' Ascending='FALSE' /></OrderBy>";
sQuery.ViewFields = string.Concat(
"<FieldRef Name='PublishingPageLayout' />",
"<FieldRef Name='Title' />",
"<FieldRef Name='EncodedAbsUrl' />",
"<FieldRef Name='TestLayoutDate' />");
sQuery.ViewFieldsOnly = true;
if (!string.IsNullOrEmpty(pagingInfo))
SPListItemCollectionPosition position = new SPListItemCollectionPosition(pagingInfo);
sQuery.ListItemCollectionPosition = position;
collection = lstPages.GetItems(sQuery);
return collection;
How to get the Paging properly?
Thanks

Hi,
According to your post, my understanding is that you want to display list data using a
SPGridView with Paging in a visual web part .
The following code snippet for your reference:
VisualWebPart1.ascx:
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="VisualWebPart1.ascx.cs" Inherits="VisualWebPartProject3.VisualWebPart1.VisualWebPart1" %>
<SharePoint:SPGridView ID="sgvPagersample" runat="server" AutoGenerateColumns="false" DataSourceID="objSample" AllowPaging="True" PageSize="3">
<Columns>
<asp:BoundField HeaderText="Title" DataField="Title" />
<asp:BoundField HeaderText="Test1" DataField="Test1" />
<asp:BoundField HeaderText="Test2" DataField="Test2" />
</Columns>
</SharePoint:SPGridView>
<asp:ObjectDataSource ID="objSample" runat="server" SelectMethod="BindGridView"></asp:ObjectDataSource>
<center>
<SharePoint:SPGridViewPager id="sgvPager" runat="Server" GridViewId="sgvPagersample"></SharePoint:SPGridViewPager>
</center>
VisualWebPart1.ascx.cs:
using System;
using System.ComponentModel;
using System.Web.UI.WebControls.WebParts;
using System.Data;
using Microsoft.SharePoint;
namespace VisualWebPartProject3.VisualWebPart1
[ToolboxItemAttribute(false)]
public partial class VisualWebPart1 : WebPart
// Uncomment the following SecurityPermission attribute only when doing Performance Profiling using
// the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready
// for production. Because the SecurityPermission attribute bypasses the security check for callers of
// your constructor, it's not recommended for production purposes.
// [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)]
public VisualWebPart1()
protected override void OnInit(EventArgs e)
base.OnInit(e);
InitializeControl();
protected void Page_Load(object sender, EventArgs e)
objSample.TypeName = this.GetType().AssemblyQualifiedName;
public DataTable BindGridView()
SPWeb currentWeb = SPContext.Current.Web;
SPList lstEmployee = currentWeb.Lists["CustomList4"];
SPQuery sQuery = new SPQuery();
sQuery.Query = "<OrderBy><FieldRef Name='ID' Ascending='False' /></OrderBy>";
SPListItemCollection myColl = lstEmployee.GetItems(sQuery);
return myColl.GetDataTable();
Thanks,
Dennis Guo
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected].
Dennis Guo
TechNet Community Support

Similar Messages

  • Pages can't create kind of document  first page on vertical and second page on horizon

    help me i won't create kind of document are  first page on vertical and second page on horizon.

    pages on iOS dosnt support making new documents with landscape view. I think this would also make it so you could not combine the two orientations in a single document.
    I was able to get a landscape document made by making it on the desktop, emailing it to myself, then saving it in pages on my ipad. Not sure if that would work for a combination document.
    Jason

  • "Ghost" page numbers on every second page - how to remove?

    Hi,
    I'm setting a short book with Pages and after importing from Word, I'm seeing duplicate, partially hidden additional page numbers on every second page. I'd like to remove them entirely, keeping Pages' page numbering. Removing and inserting page numbers doesn't help and the second set of numbers can't be selected in any way (clicking, dragging don't work). One solution would be to re-import from word, deselecting page numbers beforehand, but I'd rather like avoid this step as I made many changes in Pages.
    Here's a screenshot showing the duplicate page numbers: http://dl.dropbox.com/u/3304376/pages_bug.png
    Does anybody have an idea how to remove them?

    Hello,
    Sometimes in the process of importing from Word, page numbers are improperly converted to Master Objects or Background Objects. Go to Format > Advanced > Make Master Objects Selectable. Then, with the cursor in the Margin of the document, press the Command Key (Cursor changes to an Arrow) and drag the cursor diagonally across the page number to select it. Then press the Delete key and the number should be gone. You need to check carefully to make sure that you have eliminated all the instances. There may be one per Section.
    Jerry

  • Smartforms error - no output of first line of table on second page

    After pagebreak in a SF-Table there is no output of the first tableline on the second page. I get the output of the title-line an empty line and then the next line.
    In OTF-Data I see the values but not in Print-Output or preview.
    It´s only sometimes. I´m unable to build a test-construkt with the same effect.
    OTF!  -->
    IN03TABLE_BEGIN                                 
    CP11000000D                                     
    FCHELVE   110  00093XSF101SF011110000062D X     
    SW00062                                         
    UL +0000000000000                               
    MT0170017671                                    
    CT00000000                                      
    ST0089910  8. Rate:                             
    MT0170017671                                    
    ST011081013.04.2009                             
    MT0170017671                                    
    ST0126411100,00  EUR                            
    MT0108504232                                    
    ST0089910  9. Rate:                             
    MT0226704232                                    
    ST011081013.05.2009                             
    MT0423404232                                    
    ST0126411100,00  EUR                            
    MT0102404527                                    
    ST0096010 10. Rate:                             
    MT0226704527                                    
    ST011081013.06.2009                             
    No Output of "8.Rate 13.04.2009 100 EUR"

    Hi
    OTF! -->
    IN03TABLE_BEGIN
    CP11000000D
    FCHELVE 110 00093XSF101SF011110000062D X
    SW00062
    UL +0000000000000
    MT0170017671
    CT00000000
    ST0089910
    8. Rate: MT0170017671 ST0110810 13.04.2009
                 MT0170017671 ST0126411  100,00 EUR
                 MT0108504232 ST0089910
    9. Rate: MT0226704232 ST0110810   13.05.2009
                 MT0423404232 ST0 126411 100,00 EUR
                 MT0102404527 ST0096010
    10. Rate:MT0226704527 ST0110810 13.06.2009
    But 8th rec do exists in the data still what is the problem.
    Regards,
    Sravanthi

  • On iCloud pages how can you put a header on only the first page and not the second page?

    I'm trying the do a visual report and every time I put a header on the first page it goes to the next page and if I try to delete it on the second page it deletes on the first page too.

    bump

  • How to Display 10 columns in first page,next columns in second page in smartforms in sap.

    In internal table having 30 columns of data.
    i have to display like
    first 10 columns in first page with page no :1
    second 10 columns in second page with page no :2
    third 10 columns in second page with page no :3
    how to develop this.
    please how develop this in smartforms .
    please help .

    Hi,
    You dont have to divide the data.
    You must be using TABLE node in your smartform to display the table.
    Copy the node 2 times more so that the total table nodes become 3.
    Now, change the headings in each table according to the column you want to display.
    Change the fields of the workarea in the ITEM lines accordingly.
    Add a COMMAND node after each table and set it to go to next page.
    E.G :
    Suppose I have a table with 6 columns and I need to display 2 columns in a table then page break.
    Work area name is WA.
    Then first table will have headings : FIELD1 FIELD2
    Items will have field     :     WA-FIELD1 WA_FIELD2
    COMMAND NODE : Go to Next Page
    Second table will have heading : FIELD3 FIELD4
    Items will have field     :     WA-FIELD3 WA_FIELD4
    COMMAND NODE : Go to Next Page
    Third table will have heading : FIELD5 FIELD6
    Items will have field     :     WA-FIELD5 WA_FIELD6
    So, same table with same work area will be used 3 times, displaying different set of columns in each TABLE node.
    Regards,
    Ashish

  • Map with 500 pdfs. How to make a new file with only the first pages, new file with second pages etc.

    Hi,
    A client confronted me with the next question:
    I have a map with 500 pdf's in it.
    Is it possible to make a new file with only the first page of each pdf?
    After that to make a new file with only the second page of each pdf?
    And after that the third?
    Etc.
    Is that possible with an action?
    Or are there scripts for?
    I couldn't find them.
    I use an iMac with Acrobat XI.
    Any help is very welcome.
    Thanks in advance.
    Bornholm

    You can extract each page from each pdf as a seperate page.     Once this is done you can select the pages tocombine.
    You would have to write custom a custom JavaScript and programatically code the names to combine if the extracted file pages habvestandars naming that could  be programed. There maybe some security  coding you will have to do because of Adobe restrictions but this all documented in the Acrobat JavaScript Reference.

  • Page numbering starting on second page...

    I can't for the life of me figure out what I'm doing wrong here. All I want to do is start my numbering from 1 on the second page, leaving the first page (title page) without a page number. I know this can be done because it is formatted this way on the screenplay template, but after searching the manual, online help, and this forum and I cannot find anything that will make this work. I've also tried "view invisible" to see how the template is formatted but I cannot get it to work on a new document. Any help would be greatly appreciated!
    Thanks!
    iBook   Mac OS X (10.4.4)  

    Jynx,
    Try this:
    1. Start with a blank doc and turn on Show Invisibles.
    2. Click on Insert > Section Break
    3. In the Inspector, click on the Layout Inspector (2nd icon from left)
    4. Put your cursor in the second section of the doc
    5. In the Layout Inspector, click on Section tab
    6. Make sure First Page is Different is checked, and Use Previous Headers & Footers is UNchecked
    7. Use the option to begin your numbering where you want it to start
    This work for you?
    -Dennis

  • Page Numbers Starting on Second Page as Page Number 1

    I'm writing essays for my AP World History class and I need a cover page that doesn't have a page number as the first page of the document. Then my essays will go in order from the second page, but the page numbers need to start as 1. I have already clicked "First page is different" in the inspector under Section, but it starts the page numbering at 2 instead of the needed one. Any ideas on how to do this?
    Thanks

    Have you tried setting the starting page number to zero? Then the next page should be #1.
    Or you can add a section break & start the numbering of the new section at 1.

  • FC publishes my 12th page as first, instead of showing the home page immediately. Page order?

    I created a site in Flash Catalyst and when I published it everything was fine. Then I went back in and created a site map and suddenly, when I open the web page, the Site Map shows up first, instead of the home page. Is there a way to determine page order? I've checked to make sure that this page is not showing in any of my other states/pages. Help?

    Have you checked which state is set as the default? You can see which state is the default by the dark dot in the upper right of the color bar. To set it, right-click (option-click) on the state that you want the as the default from the contextual menu that will appear.
    Chris

  • 11i Login Page is showing 'Error on Page' while using IE 7

    Hi DBAs,
    I am using Oracle 11.5.10.2 with DB 10.2.0.4 (Single Instance). The EBS is on RUP6 and using JDK 1.6.0_12.
    I was using Firefox and not getting any issue. I used first time IE-7 (7.0.5x) to access the application. I noticed that Pressing the 'Login' button on Login Page , it was saying in the left bottom of the IE says 'Error on page' and was not navigate to any page or did not perform any action.
    I verified all the services and everything was OK. While using Firefox , I was able to navigate the application w/o any issue.
    Using IE 7 , I am able to access
    http://host.domain:8000/OA_HTML/fndvald.jsp?username=sysadmin&;password=sysadmin
    Most of the stuff seems to be working fine while logging in using above URL but the 'GO' buttons are throwing same error in IE 'Error on page'. Rest of the Bottons like 'Edit Navigator' , 'Edit Favorites' are working fine but when on any Page I press the 'Go' button then IE showing Error. It seems to me that when a button need to navigate to next page then IE saying 'Error on page' but when a button have to lunch a new page it is working fine.
    All the responsibilities and links are working fine. Application Navigation using Firefox is working absolutely fine.
    Seeking your advise and suggestions to resolve the issue.
    Thanks
    -Samar-

    Hi Samar,
    You can clear the cache as follows (login as applmgr user, and source the application env file):
    $ cd $COMMON_TOP/_pages
    $ rm -R *
    ML Note: 285218.1 is not helpful as I am on later version of EBS (11.5.10.2 with RUP6 and Developer6i Patchset 19). At Client side I am using Windows XP SP3 with IE 7.0.5.x with JInit 1.3.21 and JRE 1.6.0.12.Did you review the steps under "Recommended MSIE Browser Settings" section?
    Can you reproduce the issue with JInitiator? If yes, any errors in the JInitiator console window? Enable debug (you may also enable trace for Sun JRE) and see if any errors are reported there.
    Note: 549423.1 - How to enable tracing and logging for Sun JRE (Native Plug-in)
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=549423.1
    Regards,
    Hussein

  • The new tab page is showing Gmail inbox pages, meaning anyone can start a new tab and get access to my email. How do I stop this?

    When I open a new tab, within the pages brought up is my gmail inbox. This mean anyone can have access to my inbox without logging in, without my password. How do I restrict this access?

    If you log out of Gmail, then clicking the thumbnail should take you to a login page. If you don't log out, then anyone can access your email just by typing gmail.com in the URL bar. But you're right that the picture does create a temptation to click...
    You can set the new tab page back to blank if you prefer. However, please note that the page thumbnails are stored in the browser cache, so you also need to clear your cache to flush out existing thumbnails if you don't want anyone to be able to see them.
    More info: [http://support.mozilla.org/en-US/kb/new-tab-page-show-hide-and-customize-top-sites#w_how-do-i-turn-the-new-tab-page-off New Tab Page > How to turn the new tab page off].
    Clearing cache:
    orange Firefox button ''or'' Tools menu > Options > Advanced
    On the Network mini-tab > Offline Storage : "Clear Now"

  • Data in first tab also shown in second tab

    I'm using Java Swing.
    I have a tab panel with 2 tabs. In the first tab, I entered data. I want the data to show on the Combo Box in the second tab without closing the tab panel and open it again. How can I refresh the second tab with the newly added data shown?
    Thanks!

    JComboBox box;
    JLabel info;
    JTabbedPane tabPane;
    private void render()
         tabPane = new JTabbedPane();
         JDesktopPane leftPane = new JDestkopPane();
         JDesktopPane rightPane = new JDesktopPane();
         tabPane.addTab("Left", leftPane);
         tabPane.addTab("Right", rightPane);
         Vector items = new Vector();
         items.add("Item 1");
         items.add("Item 2");
         box = new JComboBox(items);
         box.setBounds(10, 10, 100, 20);
         box.addActionListener(this);
         leftPane.add(box);
         info = new JLabel("Item 1 Info");
         info.setBounds(10, 10, 200, 20);
         rightPane.add(info);
         this.add(tabPane);
    public void actionPerformed(ActionEvent e)
         if(e.getSource().equals(box))
              if(box.getSelectedIndex()==0)
                   info.setText("Item 1 Info");
              if(box.getSelectedIndex()==1)
                   info.setText("Item 2 Info");
              tabPane.setSelectedIndex(1);
    }Edited by: Snape53 on Aug 21, 2009 12:13 AM

  • First page black is ok - second page is bad

    Hi,
    I already use my Officejet 7310 a few years, and it works every good. Know there's a printproblem.
    I use the original cartdridge and it's a new one, but the first page is mostly good, but the next pages get verry bad. I can't read the text anymore and the inkt disappears?
    The next new print is not bad.
    Can someone help me?
    Thanks a lot
    Carla

    Hello,
    Sounds like a bug. If you have a small test case, could you provide
    that to our outstanding support group (http://support.bea.com or
    [email protected]), it would certainly help tracking this down.
    Thanks,
    Bruce
    venkata wrote:
    >
    I am processing an input xml file (say input.xml) via (report.xsl) to generate
    a report.
    report.xsl in turn loads another *xml file (schema.xml) through document() function
    so as to process the input.xml. <schema.xml> contains some look-up information
    dictating how <input.xml> need to be processed.
    Here is how I am referencing the "schema.xml" in the "report.xsl".
    <xsl:variable name="schemaFile" select="document('schema.xml')"/>
    <xsl:variable name="schemaRoot" select="$schemaFile/Schema"/>
    <xsl:variable name="schemaList" select="$schemaRoot/SchemaFactors"/>
    When I run the report first time (my appserver is weblogic 7.0), everything is
    working fine. I see the results I wanted.
    However, when I run the report for the second time during the same session, I
    am getting "schemaList" as empty.
    The values of "schemaFIle" and "schemaRoot" appear to be correctly loaded in both
    the cases. The problem is with "schemaList" variable which is coming out empty
    during the second iteration.
    can any of you please throw some pointers on why this is happening and how to
    resolve this?

  • I have a HP PSC 2210 all-in-one. Can I print a status page that shows count of pages printed?

    I said everything in the subject except, if there is a status page printing capability how do I do it,

    Hi there,
    This article should cover the issue you are experiencing. Give the steps outlined a shot and let us know if it helps.
    Best of Luck!
    You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too.

Maybe you are looking for

  • Convert Date to Week - ABAP Routine in transformation

    Hi all, I am trying to convert a date to a week using ABAP in a transformation. The date is coming from an external database and has the format YYYYMMDD.  I want to convert this into the standard 0CALWEEK format. I thought that converting the date to

  • Help: Links to Slide Show aren't working

    I'm baffled & frustrated. I've created a "Photo Albums" page which links 23 thumbnails to their album page. All the 23 links work to get you to the album page. But, on (only) 4 of them, the Slide Show button leads to an error page instead of to the s

  • What is average battery life everyone is getting for the Zen Mic

    I just got my Zen Micro last Thursday. I'm concern about the battery life. I haven't fully tested the battery yet, but I'm estimating that I will only get about 6-7 hours for it. The advertised time was suppose to be as much as 2 hours. Now I know th

  • Default Printer - GPO Issue

    Hello Tech Gurus, I've recently deployed a networked printer as a default printer for a certain group of computers.  I believe I've followed the instructions/process correctly.  When logging into the affected client, the subject printer properly appe

  • ORA-12154 when connects. Instant client installed.

    Hi. I am installed instant client 10.2 and cannot connect to database : give error ORA-12154: TNS:could not resolve the connect identifier specified. I am using Linux. I am set TNS_ADMIN and put into this directory file tnsnames.ora with all necessar