Home > Programming, codeproject > JQuery.UI Dialog with ASP.NET empty post values

JQuery.UI Dialog with ASP.NET empty post values

March 20th, 2009

Ran into an issue using a jQuery.UI.Dialog control on an asp.net web form today.  When defining a dialog jQuery.UI takes the dialog and appends it right before the closing </body> tag.  This is outside of the <form> tag causing any values you wanted from the form to be empty in your code-behind.

Here is the fix that worked for me:

$('#dialog').parent().appendTo('/html/body/form[0]');


This works great and the dialog now displays as expected, capturing the results in the code behind except for I originally wanted the dialog wrapped in a UpdatePanel. In order to fix this issue, I created an empty div and appended the dialog content there:

$('#dialog').parent().appendTo('#dialog_target');


Not the results i expected. When the content refreshes the dialog is messed up. The answer was to move the content panel inside of the dialog with the user control doing all the work!!!

<div id="dialog" class="ui-widget-content ui-corner-all" title="Add New Client"></div>

Programming, codeproject , , ,

  1. Glenn
    | #1

    Thanks, worked a treat :)

  2. | #2

    Dude! You saved me a lot of time. Thanks for the awesome fix.

  3. Ken
    | #3

    This was a real life saver. Thanks!!

  4. Rick
    | #4

    Wow, really saved me so much time.

  1. | #1