Specific performance:
1. The submit button is invalid. No response is returned after you click the button.
2. Even if the page is submitted using other means, the server cannot obtain the form data in the Dialog.
Cause: JQuery will append the Dialog element to the Body instead of the form element. After studying the page source code, it is found that the HTML elements dynamically generated during the initialization of the jQuery UI Dialog control are added to the end of the page and the end of the form element, the original Dialog template (which contains form elements) is moved to the dynamically generated HTML element. That is to say, the form originally in the form is moved out of the form after the Dialog initialization, which leads to all the forms in the Dialog template being invalid.
1st methods:
I wonder whether the Dialog design of jQuery UI is a function or a bug. In order to implement normal page submission in the Dialog, according to the above analysis, I found a simple solution-in the "open" event handler of the jQuery UI control, I moved the HTML elements dynamically generated by the Dialog control to the form element. The Code is as follows:
Code: $ ("# dialog"). parent (). appendTo ("/html/body/form [0]");
Or
$ ("# Dlg"). dialog ({
Open: function (){
$ ("Body> div [role = dialog]"). appendTo ("form # aspnetForm ");
}
});
In the Code, "aspnetForm" is the ID of the current page form Element automatically generated by the ASP. NET application. You can replace it with the form ID of your own page.
2nd methods:
Add a div such as <div id = "dialog_target"> </DIV> and write the Dialog into the DIV.
$ ("# Dialog"). parent (). appendTo ("# dialog_target ");
3rd methods:
1. Modify the Dialog JS Code and add the code to the form instead of the body.
2. The custom HTML in Dialog is not used, but an IFRAME is directly added to move the HTML in it to another page, interaction with the parent page is OK (this method is used, so that the independent code can be reused)
2nd methods, server events can be responded, and the effect is also good, you can give priority.