When the Asp.net modal dialog box is closed, the server code will be executed.

Source: Internet
Author: User

Recently, an access project was migrated to Asp.net + sqlserver. In this case, in a button event of the access form, CodeThis is basically the function: In the pop-up modal dialog box, after closing the dialog box, continue with a piece of database operation code.
The pop-up modal dialog box in Asp.net is easy, but the server code will be executed after the modal dialog box is closed. This requires that the page be submitted immediately after the dialog box is closed. So we have the following solutions.

Drag the server button in the web form, and assume that the button ID is btncomput. In the page_load file on the hidden page, use the following code:
Btncomput. attributes ("onclick") = "window. showmodaldialog ('') ". The parameter is the Web form of the dialog box.
Execute the database operation code after the dialog box is closed in btncomput server events.

When you click btncomput, the client Javascript is executed first. After the modal dialog box is displayed, the page is not submitted. After the dialog box is closed, JavaScript is executed, and then the web page is submitted, continue to execute server events. In this way, the buttons in access are implemented together with the client code and the server Event code.

I hope to give some reference to my friends who are doing similar projects.

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.