Developer forum

Forum » CMS - Standard features » GridRow position on page

GridRow position on page

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

Is there any way I can figure out the position of the current GridRow on a page?

I see that I can get the current GridRow by using Dynamicweb.Services.Grids.GetGridRowById which in turn has a "Sort" property.

But can I also read the number of GridRows on the current Page?

Thank you,

Adrian

 


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Adrian,

You may already have discovered this seeing as I'm late with a response, but yes, you can get the number of rows on a page. Instead of calling GetGridRowById, you can call GetGridRowsByPageId. That will give you the list of rows on that page. You can either use the count or loop through them all. Be aware though, that this will fetch all rows for the page, so depending on the number of rows on the page, this maybe inefficient. However, all rows are cached, so it's probably not going to be an issue.

- Jeppe

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Jeppe,

Thank you very much for the response.

I have found an alternate solution in the meantime but I might as well use yours.

Thank you,

Adrian

 

You must be logged in to post in the forum