Skip to main content

Notifications

Community site session details

Community site session details

Session Id : ZIX7gEpvcVOl9CqrXvURxc
Power Apps - Building Power Apps
Unanswered

Error message: "Select of a control that is within a container control, such as a gallery, from outside the container. Select can be used within a container control when both controls are within the same container."

Like (0) ShareShare
ReportReport
Posted on 14 Mar 2024 07:37:17 by 19

I am getting this error message:  "Select of a control that is within a container control, such as a gallery, from outside the container. Select can be used within a container control when both controls are within the same container."

 

 

 

sdfsdfsfsdfsfsd_1-1710398495874.png

 

I am using the Select(Gallery Name, Row Number) function

to select the gallery and the particular row in the gallery.

Select(SPRGallery, cvSPRGalleryRowNumber);

The Select() function is being executed in the screen's OnVisible event.

 

sdfsdfsfsdfsfsd_2-1710398594590.png

 

 The selected row is highlighted using the gallery's TemplateFill property.

 

But sometimes I get this error message.

sdfsdfsfsdfsfsd_3-1710400716985.png

 

Can someone explain why I am getting this error?

But the error does not occur every time.

 

 

  • leden Profile Picture
    26 on 17 May 2024 at 05:45:36
    Re: Error message: "Select of a control that is within a container control, such as a gallery, from outside the container. Select can be used within a container control when both controls are within the same container."

    Thank you, this is very helpful and makes a lot of sense.

    The documentation hints at this but is I think in need of correction, as it suggests that the second parameter should be an integer (index of record) whereas you are saying it should be the record itself.

    leden_0-1715924549950.png

    Also to address "because we have no way of telling which instance of the control you want selected", couldn't it assume that if the 2nd and/or 3rd parameters are omitted then it is the Gallery2.Selected record which should determine the record to select, and the gallery's OnSelect event that should be fired?

     

  • LS-04091539-0 Profile Picture
    19 on 16 May 2024 at 21:09:23
    Re: Error message: "Select of a control that is within a container control, such as a gallery, from outside the container. Select can be used within a container control when both controls are within the same container."

    I got this response from a Microsoft Escalation Engineer if it would help anyone:

     

    The error you're reporting is saying that you cannot do Select() on a control within a gallery, because we have no way of telling which instance of the control you want selected.  That control is going to be instantiated for each time in the gallery, so there could be dozens or hundreds of instances of it.

     

    To specify, you need to use the other parameters available for the Select() formula, which let you specify the row and child control to be selected.  For example if I want to do Select() on the first instance of Button1 in my gallery, I can do this:

     

    Select(Gallery2, First(Gallery2.AllItems), Button1)

     

    If I want to do Select() on the SelectedItem from the gallery, I can do it this way:

     

    Select(Gallery2, Gallery2.Selected, Button1)

  • RPeoples Profile Picture
    4 on 08 Apr 2024 at 20:43:25
    Re: Error message: "Select of a control that is within a container control, such as a gallery, from outside the container. Select can be used within a container control when both controls are within the same container."

    I just started seeing this error as of 4/8 - it was working perfectly on 4/5.  New version released?

  • leden Profile Picture
    26 on 14 Mar 2024 at 16:13:03
    Re: Error message: "Select of a control that is within a container control, such as a gallery, from outside the container. Select can be used within a container control when both controls are within the same container."

    I am getting the same error. I am also calling the Select(myGallery) in the screen's OnVisible event, but have now tried putting a button into the same container as the gallery (the button and the gallery are siblings in a container), and even pressing this button manually produces the same error. I am not passing a row number. In my case the message always occurs.

    Sorry, I don't have a suggestion, but you are not alone.

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 58

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 42 Super User 2025 Season 1

Overall leaderboard