user517406
user517406

Reputation: 13773

JQuery UI Dialog and OnClick event

I have a JQuery UI Dialog which I have put an ASP.NET button on. I need to be able to call a server side OnClick event from this, but it is never called. Here is my Dialog, can somebody help?

<div id="dialogWrapper" runat="server">
    <div style="height: auto; width: auto;" id="dialog">
        <table> 
            <tr>
                <td width="300px" valign="top">
                    Current Documents :
                </td>
                <td width="300px" valign="top">
                    <table>
                        <tr>
                            <td>
                                Upload Document :
                            </td>
                        </tr>
                        <tr /><tr />
                        <tr>
                            <td>
                                <asp:FileUpload id="fileUploadControl" runat="server" Width="200px" />
                            </td>
                        </tr>
                        <tr /><tr />
                        <tr>
                            <td>
                                <asp:Button  ID="btnUploadFile" runat="server" OnClick="btnUploadFile_Click" Text="Upload File" />
                            </td>
                        </tr>
                    </table>

                </td>
            </tr>
        </table><br />
    </div>
</div>

EDIT : Here is how the dialog is being created :

$(document).ready(function() {

    $('#<%=dialogWrapper.ClientID %>').dialog({
        autoOpen: false,
        height: 250,
        width: 600,
        modal: true,
        title: "Upload/Open Files",
        show: "drop"
    });

});

Upvotes: 1

Views: 2302

Answers (1)

keyboardP
keyboardP

Reputation: 69372

jQueryUI puts the Dialog box outside of the ASP.NET Form tag and so your button won't register. Try appending the dialog to the Form tag like so:

    $('#divDialog').dialog({
     //your normal dialog settings...


      open: function(type,data) {
        $(this).parent().appendTo("form");
      }
    }); 

From this post.

Upvotes: 4

Related Questions