Search code examples
javascriptasp.netiframejquery-dialog

How to add an <asp:button> to a jquery ui dialog containing an iframe


This is how my dialog is generated:

$(function () {
    $(".btnDialog").click(function() {
        //e.preventDefault();
        var $this = $(this);
        $('<iframe id="PDFDialog"  frameborder="0" src="' + this.href + '" />').dialog({
            title: ($this.attr('title')) ? $this.attr('title') : 'External Site',
            autoOpen: true,
            width: 700,
            height: 600,
            modal: true,
            resizable: true,
            overlay: {
                opacity: 0.5,
                background: "black"
            }
        }).width(650).height(550);
        return false;
    });
});

Where and how do i add any server controls such as <asp:label runat="server"> and < asp:button runat="server">???


Solution

  • I think what you want to do is create a new aspx page, for instance Dialog.aspx, and put your asp:Label, asp:Button, etc. controls on that page. Then set your iframe's src to the aspx page:

    $('<iframe id="PDFDialog" frameborder="0" src="Dialog.aspx" />').dialog //...