Hi all. I created a custom asp.net server control. It works fine on a regular asp.net page and as a DOM object inside of the browser. But I've never used the UpdatePanel before and now I'm trying to make sure that this control works there as well. It doesn't. If I add my control to the page outside of an update panel and click some panel's inside button (trigger), everything works fine. But if I place my control inside of update panel and click that button again, the control "disappears" from the page completely. I still can see my control in javascript debugger and the update, meaning that the object itself is still in DOM. It looks like the panel just "hides" the outer div element of my control for some reason. I tried to call panel's Update() method on button click handler, set panel's UpdateMode to both Conditional and Always. All with the same result. How can I fix that? Thank you!
A:
Posting from another computer, in response to TriLLi: Here is my aspx code. Again, the UpdateMode can be Conditional or Always - the result is the same, the cc1:WebControl disappears but the lblInfo label is there, fully functional after the btnTest click.
<form id="form1" runat="server">
<asp:scriptmanager ID="scrManager" runat="server"></asp:scriptmanager>
<div>
<asp:updatepanel ID="pnlTest" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="designer">
<cc1:WebControl ID="ceFirst" runat="server" decisionxmlfilevirtualpath="/Person.config" autolist="User" help="Off"></cc1:WebControl>
</div>
<div class="designer">
<asp:label ID="lblInfo" runat="server" forecolor="red"></asp:label>
</div>
<div class="designer">
<asp:button ID="btnTest" runat="server" width="100" text="Test" />
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnTest" EventName="Click" />
</Triggers>
</asp:updatepanel>
</div>
</form>
Sasha
2010-05-23 19:15:03
I am not so sure about this, but if your control use javascript to show you need to recall javascript code when update panel ends callback, try to add in your code behind if update panel is in callback ScriptManager.RegisterStartupScript(....
TriLLi
2010-05-23 19:53:00
Yes, I'm aware of that and do that. I'm sure I'm missing something very simple here. Thank you, though.
Sasha
2010-05-23 20:49:56
Guys. Anyone else with suggestions, please? :)
Sasha
2010-05-23 23:19:43