Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8292381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:27:36+00:00 2026-06-08T13:27:36+00:00

I have a parent page Page1 which has button1. Page1 has a usercontrol uc1.

  • 0

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 visibility is not correct.

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T13:27:38+00:00Added an answer on June 8, 2026 at 1:27 pm

    If you use the event-driven model approach

    Delegate/EventArgs code:

    public class ButtonVisiblityEventArgs : EventArgs
    {
        public ButtonVisiblityEventArgs(bool visible)
        {
            this.Visiblity = visible;
        }
    
        public bool Visiblity { get; private set; }
    }
    
    public delegate void UpdateParentButtonVisibilityEventHandler(object sender, ButtonVisiblityEventArgs args);
    

    User control code:

        public event UpdateParentButtonVisibilityEventHandler RaiseUpdateParentButtonVisibilityEvent;
    
        private void RequestParentButtonVisibilityChange(bool setVisible)
        {
            if (RaiseUpdateParentButtonVisibilityEvent != null)
            {
                RaiseUpdateParentButtonVisibilityEvent(this, new ButtonVisiblityEventArgs(setVisible));
            }
        }
    

    And in your command handler, just call:

        RequestParentButtonVisibilityChange(false);
    

    whenever you want to hide the button. On your page:

        protected void Page_Load(object sender, EventArgs e)
        {
            this.RaiseUpdateParentButtonVisibilityEvent += new UpdateParentButtonVisibilityEventHandler(uc_RaiseUpdatecurrentDisplayPanelRequestEvent);
        }
    
        private void uc_RaiseUpdatecurrentDisplayPanelRequestEvent(object sender, ButtonVisiblityEventArgs args)
        {
            button1.Visible = args.Visiblity;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview inside updated panel on parent page which is populated based
I have an aspx master/content page scenario. The parent page has an IFrame which
I have a parent page which has an iframe and also has javascript which
I have a parent page which has a drop down list in it. using
I have a dynamic page which has a parent div called 'divWiz' where I
I have a parent object called Page that has a List of objects called
I have a parent component, say P, which has function, say Pfunc. I also
Here is a problem I have encountered. I have jsp page which has a
I have a page in JQuery mobile, which contains a form. The form has
I have a WPF page which has a DataContext assigned to it. On this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.