In ASP. NET, the dialog under jquery UI is used, and the server button does not respond.

Source: Internet
Author: User

The UI control under jquery seems to be faulty. One day I debug a jquery dialog from AM until AM. At that time, I placed a server button in the dialog and bound the button to an event processing function in codebehind. However, the strange thing is that I didn't respond to the subsequent event functions when I clicked the button, I went crazy.

After dawn, Google finally found the reason: jquery will append the dialog element to the body, rather than form, and it is sweating. Millions of people who use jquery UI are overwhelmed, so they trust the jquery UI team too much.

I found three solutions:

1st methods:

Code: $ ("# dialog"). Parent (). appendto ("/html/body/form [0]");

 

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)

 

I use 2nd methods. server events can be responded to, and the results are also good.

 

Http://douyunliang.blog.sohu.com/129047116.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.