开发者

Custom server control disappears from page when UpdatePanel updates

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. 开发者_如何学PythonIt 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!


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜