wix location.to code for linking button

Hi Corvid folks. I am trying to link my “edit profile” button on the members profile back to the Edit Profile page. With the below, can anyone tell me what my code should be:

id names:
Button= #editProfilebutton
Edit Profile page = (BiProfileData Edit Profile (Business Name, ID))
Current Page= BizSearchResults (BizName,ID))

Why do you need to use Wix Location API and the to() function for this?

When on your other forum post here.
https://www.wix.com/corvid/forum/community-discussion/connector-not-showing-all-dataset-options

You already have the button linked to a page through the button link setting itself.

You can’t link a button itself and use code to do exactly the same thing.

If you follow the member profile tutorial from Wix here.
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area

It will show you how to link a button - in code - to the appropriate profile page.
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area

When the profile button is clicked, we use an event handler to send members to their personal profile page.

We add an event handler by selecting the profile button and we use the Properties panel to add a handler for the onClick event.

Then we add the event handler code, which looks like this:

export function profileButton_click(event) {
  wixLocation.to(`/Members/${wixUsers.currentUser.id}`); 
}

HI GOS, thank you for the guidance. The Wix connector is not displaying the dataset i need, so i just disconnected it and wanted to try using code instead.

I have actually tried that eventhandler code (so yay i was on the right track!) however it did not work for me. Do you know if i will have to change “Members” to the page i have in my site or the entire code just stays exactly the same?