Finally, I started to write the B/S program.
Today I encountered a problem: how to handle the modal dialog box. The specific requirements are as follows: click "add" on the selection page to bring up the modal dialog box. After adding a record in the dialog box, select "OK" to close the dialog box, update the data in the table on the home page.
There are many discussions on the modal dialog box on the internet. I tried it for a day and found a better solution:
1. Displayed dialog box:
Add the following to the javascript script file:
Function OpenEditWin (frmWin, width, height)
{Var me;
// Pass the parent page window object as a parameter to the dialog box, so that the dialog box can manipulate the parent page to automatically refresh.
Me = window;
// Display the dialog box.
Window. showModalDialog (frmWin, me, 'dialogwidth = '+ width + 'px; dialogHeight =' + height + 'px; help: no; status: no ')
}
Call in C:
Using Add. Attributes. Add ("onclick", "javascript: OpenEditWin ('" + Session ["showForm"] + "', 540,400 )");
Many methods are implemented using Response. Write or RegisterStartupScript, but they all have problems, such as the blank page when the dialog box is displayed and the pop-up dialog box when the page is refreshed.
Add a jscript to the dialog box
Session ["showForm"] is the aspx file name in the dialog box. The content is very simple. Some text boxes are designed on the page for users to enter relevant information, as well as the "OK" and "cancel" buttons, when the "OK" button is selected, save the data in the text box to the database, and close the dialog box. If the "cancel" button is selected, the operation is canceled.
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.