Change to UI Dialog ASPX

Change to UI Dialog ASPX

Hi all,

I am currently having to use a custom version of UI as the current one has a "bug" in it which could easily be fixed with an option. the bug is to do with the way the page posts-back (probably only in aspx,NET).

Currently if i use a dialog with a text filed or any other filed in it, when the page posts back to the server, these fields and data are not posed back with it. I have a div:

<div id="dialog">
        <p>Add a new store.</p>
       
        <fieldset>
       
            <table>
            <tr>
            <td>
            Store Number:
            </td>
            <td>
                <asp:TextBox ID="txtNewNewStoreNumber" runat="server" ></asp:TextBox>
              
            </td>
            </tr>
            </table>
            </fieldset>
            </div>

On pageLoad i create the dialog: $("#dialog").dialog(); howver when this page now posts back i can not access the txtNewNewStoreNumber text box in my code (such as txtNewNewStoreNumber.Text). All other elements outside the dialog are unaffected.

Cause:
The cause seems to be the fact that when the dialog is created, it creatas a new div and appends it to the body: uiDialog = (self.uiDialog = $('<div></div>'))
                .appendTo(document.body)

This then removes the elements in the dialog from the form. when the page posts back, they are not in the form and therefore are not accessible.

Fix:
Change (or add an option) to be able to change where the new div is place. I changed it to:

uiDialog = (self.uiDialog = $('<div></div>'))
                .appendTo(document.forms[0])

and now the dialog still works fine, and the fields are accessible in the postback.

Scotty.