Skip to main content

Notifications

Community site session details

Community site session details

Session Id : v/8qq9zJjEE7XxkWz2ZRNp
Power Apps - Building Power Apps
Answered

Control Visibility of Two Containers with Dropdown Controls

Like (0) ShareShare
ReportReport
Posted on 5 Dec 2023 20:52:55 by 4,718 Super User 2025 Season 1

I have Main Screen, or which are 'Container1' and 'Container2'.

Both containers have a dropdown that have a list of views.

In 'Container1' visible I have If(Current_View_Dropdown_1.Selected.Value="Edit View",true,false)

In 'Container2' visible I have tried If(Current_View_Dropdown_1.Selected.Value<>"Edit View",true,false)
and I've tried If(Current_View_Dropdown_2.Selected.Value="Edit View",false,true).

I can get 'Container1' to hide, but I can't get 'Container2' to appear. I keep getting a circular reference error.

How do I get the two containers to appear independent of each other?

What am I missing?
Phineas_0-1701809346457.png

 

Categories:
  • Phineas Profile Picture
    4,718 Super User 2025 Season 1 on 06 Dec 2023 at 16:27:22
    Re: Control Visibility of Two Containers with Dropdown Controls

    Yep.

     

    Wrestled with it yesterday for an hour or so until I got it in a bare-naked chokehold, figured it out and got it working.

     

    Thanks!

  • Verified answer
    PA_nerd Profile Picture
    63 on 06 Dec 2023 at 14:29:50
    Re: Control Visibility of Two Containers with Dropdown Controls

    Ok, I think I understand now.  Basically Container 1 is an edit and Container 2 is a "view only", and either drop down can make it edit or view only.  Please try the following:

     

    Container 1 OnChange: 

    If(
      "Edit View" in Dropdown1.SelectedText.Value || "Edit View" in Dropdown2.SelectedText.Value,
      Set(var_Edit,true),
      Set(var_Edit,false)
    )

     

    Container 2 OnChange:

    If(
      "Edit View" in Dropdown1.SelectedText.Value || "Edit View" in Dropdown2.SelectedText.Value,
      Set(var_Edit,true),
      Set(var_Edit,false)
    )

     

    Container 1 Visible:

    If(var_Edit,true,false)

     

    Container 2 Visible:

    If(var_Edit,false,true)

  • Phineas Profile Picture
    4,718 Super User 2025 Season 1 on 05 Dec 2023 at 22:58:54
    Re: Control Visibility of Two Containers with Dropdown Controls

    I've been playing with it for about an hour.

    I've almost got it working. There needs to be a way to reset Dropdown_1 to 'Edit View' in the Onchange of Dropdown_2, or they both are visible at the same time.

    I've entered the formulas exactly as you have suggested.

    With 'Container1' dropdown showing 'Edit View' and 'Container2' NOT showing 'Edit View', both containers appear, when only Container1 should appear.

    'Container1' (with Edit View) -

    Phineas_0-1701816470454.png


    When I change 'Container1' dropdown to other than 'Edit View' (and 'Container2' is NOT 'Edit View'), 'Container1' remains and 'Container2' disappears, when it should be the opposite. If neither container is 'Edit View' 'Container2' should be visible.

    When 'Container2' dropdown is 'Edit View' it should be hidden and 'Container1' should be visible.

    Container1 -

    Phineas_1-1701816666849.png

  • PA_nerd Profile Picture
    63 on 05 Dec 2023 at 21:17:41
    Re: Control Visibility of Two Containers with Dropdown Controls

    Hi! 

    Are you wanting the selection of drop down 1 to show/hide container 2 and vice versa?

    If so, I would set a variable in the onChange event of each drop down.

     

    For Container 1's OnChange:

    If(

      Current_View_Dropdown_1.Selected.Value="Edit View",

      Set(var_showContainer2,"true"),

      Set(var_showContainer2,"false"))

     

    For Container 2's OnChange:

    If(

      Current_View_Dropdown_2.Selected.Value="Edit View",

      Set(var_showContainer1,"true"),

      Set(var_showContainer1,"false"))

     

    And then your visible on Container 1 would be:

    If(var_showContainer1,true,false)

     

    And likewise the visible on Container 2 would be:

    If(var_showContainer2,true,false)

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

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started