Setting Content Block Visibility from a user control

Posted by Community Admin on 04-Aug-2018 18:11

Setting Content Block Visibility from a user control

All Replies

Posted by Community Admin on 17-Apr-2012 00:00

On my page, I have a content block that was dragged on to the page.  I named it 'MainContentBlock'.  I also have a custom widget that has a postback.  When a user clicks a link and causes a postback, I want to set the Visibility of MainContentBlock = false from inside the custom widget code behind.
How can I do this?
Something like this in the page_load of my user control:

protected void Page_Load(object sender, EventArgs e)
    if (IsPostBack)
               
         //set the visibility of the dragged content block here
         Parent.FindControl("MainContentBlock").Visible = false;
         

This thread is closed