mnu-nasir
mnu-nasir

Reputation: 1762

Print dropdown selected value into a label after button click

I am new to the power app. I have created a screen. On my screen, there is a Dropdown Control. Dropdown control is populated values with the below code:

Table({Text: "Bangladesh", Val: 1},{Text: "India", Val: 2},{Text: "Pakistan", Val: 3 })

I have a button and Label. Now I want when the user clicks on the button the selected value of the dropdown will be printed on the label. I used the below code for the OnSelect property of the button

Label2.Text = Dropdown1.Selected.Text

But nothing happens. Can anyone help me?

Upvotes: 0

Views: 3998

Answers (1)

Nackoo
Nackoo

Reputation: 111

You can't directly assign a component property from outside this component

I suggest you to use a variable to store your DropDown1 selected value on the button OnSelect property, and then assign your variable on your Label2 Text property, here are the formulas :

[Button] OnSelect : Set(varValue, DropDown1.Selected.Text)
[Label2] Text : varValue

Have a good day

Upvotes: 1

Related Questions