Get current page url in kentico

Kha Nguyen asked on May 27, 2018 17:11

I have 4 links after I paging:
"localhost/WebProject/RESOURCES/Video.aspx?viewmode=0",
"localhost/WebProject/RESOURCES/Video.aspx?viewmode=0&page=2"
"localhost/WebProject/RESOURCES/Video.aspx?viewmode=0&page=3"
"localhost/WebProject/RESOURCES/Video.aspx?viewmode=0&page=4"

It is same as: < | 1 | 2 | 3 | 4 | >

When I click on number 1, it is this page: "localhost/WebProject/RESOURCES/Video.aspx?viewmode=0", I click on number 2, it is this page: "localhost/WebProject/RESOURCES/Video.aspx?viewmode=0&page=2". I want to add class="active" (<li class="active"></li>)into page which I clicked. But I only see function IsCurrentDocument(), I don't see any function about page on kentico as IsCurrentPage(). How shoud I do? Thank you!

Recent Answers


Peter Mogilnitski answered on May 27, 2018 18:20 (last edited on May 27, 2018 18:27)

I think you can do with pure javascript/JQuery. You have to match your current window URL i.e. var loc = window.location.href and your pagination. There are examples how to do it for menus, but the same principle applies to pagination. There is also how to get parameter from URL

0 votesVote for this answer Mark as a Correct answer

Harpreet Singh answered on May 30, 2018 08:02

You need to get NodeAliasPath of current document and construct url by appending page number and parameters.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.