asp.net the problem of continuing to execute server-side code after the modal dialog box is closed-practical tips

Source: Internet
Author: User
Recently doing a migration from an Access project to asp.net + SQL Server, where this is the case, in a button event in an Access form, the code is basically the function: pop-up modal dialog box, and then continue with the database operation code after closing the dialog box.
It is easy to eject modal dialogs in asp.net, but continue to execute the server code after the modal dialog is closed, which requires that the page be submitted immediately after the dialog box closes. So there are the following solutions.

Drag the server-side button in the Web form and assume that the button ID is btncomput, in the Page_Load of the hidden page, as in code:
Btncomput.attributes ("onclick") = "window.showModalDialog (')", the argument is the dialog Web Form.
Executes the database operation code after the dialog box closes in the Btncomput server-side event.

Because when you click Btncomput, first execute client JavaScript, after the modal dialog box, the page is not submitted, until the dialog box is closed, JavaScript after the execution, and then the Web page submission, continue to execute server-side events. This enables the functionality of that button in Access along with the client code and the server-side event code.

Hope to be able to do similar project friend some reference.

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.