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 9246453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:29:33+00:00 2026-06-18T09:29:33+00:00

I have a user control on a page. The user control has a public

  • 0

I have a user control on a page. The user control has a public property on it that I need to set after a button click. How do you do this?
It appears that the control is rendered before the button click event fires, so setting the property has no effect.

Page:
<%@ Register src=”Email.ascx” tagname=”Email” tagprefix=”uc2″ %>

protected void Page_Load(object sender, EventArgs e)
{
    if(!IsPostBack)
        EmailList.IsEditable = false;
}

protected void btn_Click(object sender, EventArgs e)
{
    EmailList.IsEditable = true;
}

User Control:
public bool IsEditable { get; set; }

The public property gets set correctly when I set it in the page load event, but not on the button click.
The button is used to change the form from read-only to edit mode. Is there a way to set a public property in the button click event? If so, how?

  • 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-18T09:29:34+00:00Added an answer on June 18, 2026 at 9:29 am

    The property is getting set just fine. The problem is where in your usercontrol you set it’s controls to readonly/enabled.

    If you want to be able to affect how the usercontrol gets rendered, you must do the logic where you’re setting the readonly/enabled properties of the subcontrols in the Page_PreRender event of the usercontrol. This event is executed after the buttonclick events.

    A must read on msdn: the page lifecycle. You’ll notice the control events get processed after Page_Load and before Page_LoadComplete.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a user control UserVote that has property to find total vote
I have a Silverlight user control that has an Image control within it. This
i have an usercontrol that has a public event. when i use this user
I have a page that has a bunch of user controls on it. I
I have a complex page that has several user controls like galleries, maps, ads
I have a user control that is being integrated to the page on run
I have a nested user control which appears on every single page. It contains
I have a custom user control called ErrorNotificationBox. To place that on my page
my structure is like this: master page aspx(web form) ascx(user control) I have a
I have a web user control, that has a table with 3 columns 1)

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.