modal dialog box in asp.net

Source: Internet
Author: User
Asp.net| dialog box finally began to write the B/s program.
Today encountered a problem, how to deal with modal dialog box. The specific requirements are: on the selection page of the "Add" button, pop-up modal dialog box, add a record in the dialog box, select the "OK" button, close the dialog box, update the data on the Home page table.

There are a lot of discussions about modal dialogs on the web, and after a day of trying, find a better solution:

1, Display dialog box:
In the JavaScript script file, add:
function Openeditwin (frmwin,width,height)
{
var me;
Passes the parent page window object as a parameter to the dialog box so that the dialog box manipulates the parent page for automatic refresh.
me = window;
Displays a dialog box.
window.showModalDialog (Frmwin,me, ' dialogwidth= ' +width + ' px;dialogheight= ' +height+ ' Px;help:no;status:no ')
}
Called in C #:
CMDADD.ATTRIBUTES.ADD ("onclick", "Javascript:openeditwin ('" + session["ShowForm"] + "', 540,400)");
Many methods are implemented with Response.Write or registerstartupscript, but there are problems, such as when the page is blank when the dialog box is displayed, and the pop-up dialog box appears when the page is refreshed.
Add a JScript script to a dialog box


session["ShowForm" is the ASPX filename of the dialog box, the content is very simple, on the page design some text boxes, let the user input relevant information, as well as the "OK" and "Cancel" button, select the "OK" button to save the data in the text box to the database, and close the dialog box, The Cancel button cancels the action to close the dialog box.



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.