web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Is possible call "OnSe...
Power Apps
Answered

Is possible call "OnSelect" of gallery button outside gallery, container?

(1) ShareShare
ReportReport
Posted on by 255

Hi, 

is possible calling OnSelect property of button which is inside gallery? Gallery is inside container. Hierarchy:

TomasG_0-1720081158878.png


Or is another way how to evoke OnSelect property of button or evoke code inside OnSelect property of button? 

Thanks for any advice. 

Categories:
I have the same question (0)
  • Verified answer
    anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    hi @TomasG ,

    Yes, you can call the OnSelect property of a button inside a gallery. However, directly invoking the OnSelect event of a button is not possible. Instead, you can place the code that you want to execute in a separate function and call that function from the OnSelect property of the button.

    Let's assume you have a gallery named Gallery1 with a button named Button1 inside it.

    1.Set a variable in the OnSelect property of the button:

     

    Set(ButtonClicked, true);

     

    2.Use this variable in another part of your app to run the desired code:

    For instance, you can use a Timer control to check the variable and execute the code.

    • Add a Timer control to your screen.
    • Set the Start property of the Timer to ButtonClicked.
    • Set the OnTimerEnd property of the Timer to your desired code and then reset the variable.

     

    // Desired code to execute
    // Reset the variable after execution
    Set(ButtonClicked, false);
    ​

     

    This approach allows you to execute the code when the button is clicked without directly invoking the OnSelect event. The Timer control acts as a mediator to run your code based on the variable’s value.

  • Daniel Bocklandt Profile Picture
    5,151 Super User 2026 Season 1 on at

    Hey @TomasG ,

     

    Well you can't select a button inside the Gallery from outside. That is because the button is in every row, so there would be no way to know for which row you want to select the button. 

     

    The workaround depends on your use case. Could you share some more details on what the button does and how exactly you want to trigger it from the outside?

     

  • TomasG Profile Picture
    255 on at

    Hi @anandm08 , 

    thanks, this helped me a lot. Many thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 494

#2
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#3
11manish Profile Picture

11manish 323

Last 30 days Overall leaderboard