locked
How to get previous and next record using DataView RRS feed

  • Question

  • User-1256377279 posted

    Hi All,

    I have an requirement where i want to Get Next and Previous records using DataView.

    Thanks in advance

    Shabbir

    Monday, September 26, 2011 10:46 AM

Answers

  • User3866881 posted

    I have an requirement where i want to Get Next and Previous records using DataView.

    Hello:)

    A very simple idea and solution is you can use the ObjectDataSource, and then you should write a select statement and fill the data contents into DataTable, and then return it with the form of DataView.

    Bind the DataView as a DataSource to the DetailsView or FormView, thus you can see record page per page (Previous or Next by numbering).

    You can also try to convert the DetailsView's FooterRow or FormView into Template mode, and then drag and drop two linkbuttons called "Previous" or "Next", then——

    In the Previous button:

    if(DetailView.PageIndex>0)

    {

    DetailsView.PageIndex = DetailsView.PageCount -1;

    }

    In the Next button:

    if(DetailsView.PageIndex<DetailsView.PageCount)

    {

        DetailsView.PageIndex++;

    }

    Thx again

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 27, 2011 9:51 PM

All replies

  • User1918766559 posted

    DataView objects are part of ASP.NET webforms in which different data can viewed using Datagrid, DataList, Repeater etc.

    Check the links for details: http://msdn.microsoft.com/en-us/library/aa479325.aspx 

    http://office.microsoft.com/en-us/sharepoint-designer-help/insert-a-data-view-as-a-form-HA010119114.aspx

    Thanks,

    Anindita,

    http://anindita9.wordpress.com

    Tuesday, September 27, 2011 6:37 AM
  • User3866881 posted

    I have an requirement where i want to Get Next and Previous records using DataView.

    Hello:)

    A very simple idea and solution is you can use the ObjectDataSource, and then you should write a select statement and fill the data contents into DataTable, and then return it with the form of DataView.

    Bind the DataView as a DataSource to the DetailsView or FormView, thus you can see record page per page (Previous or Next by numbering).

    You can also try to convert the DetailsView's FooterRow or FormView into Template mode, and then drag and drop two linkbuttons called "Previous" or "Next", then——

    In the Previous button:

    if(DetailView.PageIndex>0)

    {

    DetailsView.PageIndex = DetailsView.PageCount -1;

    }

    In the Next button:

    if(DetailsView.PageIndex<DetailsView.PageCount)

    {

        DetailsView.PageIndex++;

    }

    Thx again

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 27, 2011 9:51 PM