In practical use, we. on the ASPX page, you need to open a new window (convenient description, assuming B. aspx), you need to disable. ASPX page. B. There is an event triggered in Aspx. When the event is triggered, B. aspx.
Solution:
In this case, we 'd better choose to open B. aspx in the mode window, that is, showmodaldialog (B. aspx ).
If you open B directly in the mode window. ASPX page, if B. aspx is only a text control running on the server, such as textbox and dropdownlist (these controls cannot trigger corresponding events themselves), and the returned values of these controls will not cause any problems, however, if you want to call methods in CS such as server buttons, or trigger the event itself, a problem may occur. When these methods are triggered, the page opened in the mode window is displayed as a page (in this example, B. aspx ). The Mode window cannot be refreshed, so it is impossible for these events to update the page content in the current mode window.
This mechanism cannot be changed. When a corresponding event is triggered, the page will be reloaded once (the page_load event is triggered), even if ispostback is false.
In this case, how can we achieve the intended purpose?
Let's try this method: Use the Framework for Operations. To put it simply: Create a new page (C. aspx) and only support the framework. The corresponding sub-frame points to the specified page (B. aspx ). In this way, we open C. aspx in the mode window on the. ASPX page to achieve the expected effect. B. The ASPX page can contain any trigger event to update the page content. At the same time, if you want to pass the value, you need to first pass the value to the Framework page, and then to the established page. The origin of this method is based on the practice of colleagues. I think this method is simple and does not need to be considered too much. It is relatively easy to operate.
The second method requires Ajax knowledge. In this way, you must note that the event on this page cannot be triggered. Otherwise, the page in the mode window will pop up automatically (without page support ). In this way, we need to use the third ASPX page to process the corresponding event operations, and then return the operation results to update (update rather than refresh) the content in the mode window. This method is more difficult than the first method and is difficult to operate. Especially when the control in the mode window involves data binding, it is not easy to operate.
The third method is not successful. General idea: Use window. open () method to open B. ASPX page, B. when the ASPX page is loaded. all controls in aspx are disabled, and. the refresh function of the ASPX page is disabled.
(SHIFT + F10, F5, right-click, refresh button of the browser itself), when B. when the ASPX page is closed, a parameter is input to. on the ASPX page, all disabled resources are released until the value of this parameter is true. In practice, the open () method cannot refresh the. ASPX page after opening the B. ASPX page. On the B. ASPX page, add window. onload = funciton () {}.
Opener.doc ument. oncontextmenu = "Return false", disabled right-click
Opener.doc ument. onkeydown = function () {If (event. keycode = 116) event. keycode = 0; event. returnvalue = false;} You cannot call the corresponding event to disable the F5 key.