Setting parent page controls visibility from Child user control page in ASP .net
===

I have a parent page Page1 which has button1. Page1 has a usercontrol uc1. uc1 has an update panel inside which a grid grid1 is present. I am trying to set Page1.button1's visibility to false, depending on the row command event(there are some if conditions in the row command event) of uc1.grid1. I am setting Page1.button1's visibility in the following way:

Create a IsButton1Visible property in uc1. Set the property in UC1.Grid1.Rowcommand to false, on page1 prerender event, access IsButton1Visible and set Page1.button1 visibility.

Even though in quick watch Page1.button1 visibility is set to false at the line of assignment, when I see the UI, it is still visible. I don't know what I am doing wrong. Or the way that I am getting hold of button1 and its visiblity is not correct.

Any help would be appreciated.


In general can we set a Parent page's control's property from a user control during the user control event?