This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to reset Grid Band page number?

I would like (through an action, or a Code Snippett) to reset the page number from a Grid Band element.

We built a new search which uses two parameters independently: UID_PersonOrdered and UID_AccProduct.

We search for a certain Product and we navigate forward into the following result pages (grid band). Then we decide to search for another Product and the result stay in the actual grid band page, this number does not reset to 1.

For Example:

We search Product A, and we find the right data on the 3rd page (grid band). On that page, we search for the Product B and after clicking "Search", the results start at the 3rd Page, not on the 1st one.

Thanks in advance!

Parents
  • Hi Fermin,

    I was not able to reproduce this behavior in 8.0 with the OOB request form and search.

    You can try the following code snippet to reset the page index (replacing "GridBand1" with the appropriate identifier):

    GridBand1.DataSource.GetLevel().CurrentPage = 0;

    Regards

    Hanno

  • Hi Hanno,

    thank you so much for your help.

    I followed your suggestion and I created the following code snippet:

    var dataSource = GridBand1.DataSource;

    dataSource.CurrentPage = 0;

    However I get the following error:

    'VI.WebRuntime.Data.IControlDataSource' does not contain a definition for 'CurrentPage' and no extension method 'CurrentPage' accepting a first argument of type 'VI.WebRuntime.Data.IControlDataSource' could be found (are you missing a using directive or an assembly reference?) (CS1061)

    Do I miss something? 

    Note: i forgot to mention that I work in Version 7.1.4.

    Regards,

    Fermín

  • I edited my answer to include a call to GetLevel()

  • Thank you Hanno for your help!

    However I still have some "visibility" problems. I will try it in another way and I´ll keep you informed ;-)
    Again, thank you for your time!

    Regards,

    Fermín

Reply Children
No Data