开发者

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>
             开发者_StackOverflow中文版               <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"
    });

});


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜