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?