在Devexpress CallbackPanel PerformCallback之后,不显示Ext Control

时间:2012-02-10 14:17:01

标签: c# asp.net devexpress ext.net

我想在devexpress callbackpanel中使用Ext.Net控件。首先渲染页面时一切正常,Ext控件很好。但是,当您使用PerformCallback()函数刷新回调面板时,Ext Controls会消失。解决方案是什么?

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="devex_ext._default" %>

<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallbackPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxTabControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxClasses" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallbackPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />

    <div style="clear:both">

    <dx:ASPxCallbackPanel ID="ASPxCallbackPanel2" ClientInstanceName="cp" runat="server" Width="200px">
        <PanelCollection>
            <dx:PanelContent ID="PanelContent2" runat="server">
                <dx:ASPxPageControl ID="ASPxPageControl2" runat="server">
                    <TabPages>
                        <dx:TabPage  Text="Ext Linkbutton">
                            <ContentCollection>
                                <dx:ContentControl ID="ContentControl1" runat="server">
                                    <ext:LinkButton ID="Linkbutton1" runat="server" Text="Linkbutton">
                                        <Listeners>
                                            <Click Handler="Ext.Msg.alert('Clicked', 'LinkButton');" />
                                        </Listeners>
                                    </ext:LinkButton>
                                </dx:ContentControl>
                            </ContentCollection>
                        </dx:TabPage>
                        <dx:TabPage  Text="Asp Button">
                            <ContentCollection>
                                <dx:ContentControl ID="ContentControl2" runat="server">
                                    <asp:Button ID="Button1" runat="server" Text="Button" />    
                                </dx:ContentControl>
                            </ContentCollection>
                        </dx:TabPage>
                    </TabPages>
                </dx:ASPxPageControl>
            </dx:PanelContent>
        </PanelCollection>
    </dx:ASPxCallbackPanel>

    <ext:LinkButton ID="LinkButton2" runat="server" Text="Refresh">
        <Listeners>
            <Click Handler="cp.PerformCallback()" />
        </Listeners>
    </ext:LinkButton>

    </div>
    </form>
</body>
</html>

2 个答案:

答案 0 :(得分:0)

此代码不起作用,因为您尚未指定 ASPxCallbackPanel.ClientInstanceName 属性(并且尚未启用客户端程序对象)。

修改您的标记,如下所示:

<dx:ASPxCallbackPanel ... ClientInstanceName="cp">


<Click Handler="cp.PerformCallback()" />

检查this演示,说明如何使用ASPxCallbackPanel容器。

答案 1 :(得分:0)

如果您在回调后不使用javascript前缀'dxis_'运行javascript,请查看此topic

你可以添加,例如具有特定id的div,然后运行脚本,创建ExtJS控件,包含renderTo的配置:'specific di'