Getting the id of a button inside an asset grid


#1

Hi everybody,
I searched in the forum for some answer, but I was not able to find something similar.
So, this is mine question:
I got an asset grid from an excel file, in which I show some used cars, and upon each item, there is a button that can add the car in a compare list, creating an excel file with the added cars and another grid that read this file.
To avoid that the same car can be added more than one time, I’d wish to hide the button in the grid with all the cars, and this is easy, but I can’t understand how to show it again if the car is removed from the compare list…there is a way to get the id of the button to show/hide?
Thank you for any feedback


#2

Hi @astolfo.vesci,

If I understand correctly, you want to disable an “add to comparison” button in the first list that contains all your cars when you’re adding one to your comparison list.
IMO, the easiest solution is to add an “is selected” column in your list of cars, and change the value from FALSE to TRUE when you select a car.
You can then bind the is enabled property of your button on this field, using a NOT converter: when the car is selected, the button is not enabled.

When removing a car from the comparison list, don’t forget to set back the corresponding is selected cell to FALSE in the original list.

Seb