tags:

views:

379

answers:

1

The page markup:

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

I need to show a modal window and the content should be the invisible table. The ExtJS script for creating a window is as shown:

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();
}
A: 

Wrap the table in some sort of container (<div id='tableHolder' runat='server' style="display: none">...</div>), remove the display: none; from the table style, and then reference the container's innerHTML in your function:

function showWindow() { 
    var win = new Ext.Window({ 
        title: "Ext Window Example", 
        autoScroll: true, 
        modal: true, 
        html: Ext.get('<%=tableHolder.ClientID%>').innerHTML
    }); 
    win.show(); 
} 
jball
Thanks. I will try this out. While we are talking about modal windows, is the best practice to include the markup on the page and make it visible in the modal window or have the modal window do a ajax load and on the server side, return the markup for the modal to display?
DotnetDude
If the content of the modal window is static and not that large (large depends on the situation), then I would include the markup on the page. In the other situations ajax can be user to make a more dynamic modal and will also speed up the original page load and render time.
jball