I have a custom event that I want to use to display a previously hidden element on my page.
ASPX:
<%@ Register Src="~/Controls/EditSync.ascx" TagPrefix="IP" TagName="EditSync" %>
<asp:Content ID="main" ContentPlaceHolderID="body" runat="server">
//Some unrelated controls
<fieldset id="fsEditPlugin" runat="server" class="inputForm" style="width:450px;" visible="false">
<IP:EditSync id="ctlEditSync" runat="server" />
</fieldset>
</asp:Content>
Code behind:
protected void Page_Load(object sender, EventArgs e)
{
this.ctlDelivery.EditPlugin += new EventHandler(onEditPlugin);
if (!Page.IsPostBack)
{
//Some more unrelated things
}
}
public void onEditPlugin(object sender, EventArgs e)
{
System.Diagnostics.Debug.Write(((ip.Controls.EditPluginEventArgs)e).type);
fsEditPlugin.Visible = true;
}
the debug-message is displayed. I can place breakpoints in the event-handler and they are reached, but no matter what I try I can't manipulate the page from my event handler. The fsEditPlugin is not a child of anything else that is hidden. Some things I've tried:
//I've tried this:
<fieldset id="fsEditPlugin" runat="server" class="inputForm" style="width:450px; display:none;">
//code behind:
fsEditPlugin.Style.Add("display", "inline");
//I've tried this:
<fieldset id="fsEditPlugin" runat="server" class="inputForm" style="width:450px;">
</fieldset>
//Code behind:
fsEditPlugin.Controls.Add(new LiteralControl("TEST"));
Nothing seems to work. There isn't anything in my Page_Load that should interfere with the controls.
The event is being fired from another child web user control. So when I press a button in another child web user control I want to make the EditSync-control to become visible.