ExtJS Window在页面上显示标记 - ASP.NET

时间:2010-02-23 18:57:55

标签: asp.net extjs

页面标记:

<table style="display: none" id="myTable" runat="server">
    <tr>
        <td>First Name</td>
        <td><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
    </tr>
    <tr>
        <td>Last Name</td>
        <td><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>
    </tr>
</table>

我需要显示一个模态窗口,内容应该是不可见的表格。用于创建窗口的ExtJS脚本如下所示:

function showWindow() {
    var win = new Ext.Window({
        title: "Ext Window Example",
        autoScroll: true,
        modal: true,
        html: //Here I want to use the markup of myTable
    });
    win.show();
}

1 个答案:

答案 0 :(得分:0)

将表格包装在某种容器中(<div id='tableHolder' runat='server' style="display: none">...</div>),从表格样式中删除display: none;,然后在函数中引用容器的innerHTML

function showWindow() { 
    var win = new Ext.Window({ 
        title: "Ext Window Example", 
        autoScroll: true, 
        modal: true, 
        html: Ext.get('<%=tableHolder.ClientID%>').innerHTML
    }); 
    win.show(); 
}