about the Mode window refresh problem

Source: Internet
Author: User
Problem Description:
In practice, we need to open a new window on the a.aspx page (for description convenience, assuming b.aspx), before the new window closes, you need to disable the A.aspx page. b.aspx triggers a corresponding event, and when the event is triggered, the b.aspx should be updated.
At this point our best choice is to use the modal window to open the b.aspx, that is, ShowModalDialog (b.aspx).
If you open the B.aspx page directly with the modal window, if b.aspx is just a text control running on the server side, such as a TextBox, DropDownList, and the controls themselves cannot trigger the corresponding event, then the values of those controls will not matter. However, if you want to have a server-side button such as the method of calling CS, or itself will trigger events, there will be problems. When these methods are triggered, the page opened by the modal window is ejected as a page (this example is b.aspx). The schema window is not refreshed, so it is not possible for these events to update the contents of the page in the current mode window.
This mechanism is not able to change, triggering the corresponding event, will reload the page (triggered the Page_Load event), even if IsPostBack is false.
What can be done in this situation to achieve the intended purpose?
Let's try this method: Use the framework for the operation. Say simple: Create a new page (c.aspx), just frame support. The corresponding child frame points to the specified page (b.aspx). In this way we use the Mode window in the A.aspx page to open the c.aspx to achieve the desired effect. B.aspx page can have any triggering event to update the content of the page. At the same time, if you want to pass a value, you need to first pass the value to the frame page, and then to the established page. The origin of this method is to refer to the practice of colleagues, I think this method is very simple, do not need to have too much consideration. It's relatively easy to operate.
The second way we need to have knowledge of Ajax. This approach should be noted that the same can not trigger the event on this page, otherwise it will automatically pop-up mode window inside the page (without page support in the case). In this way we need to use the third ASPX page for the corresponding event action processing, and then return the result of the operation to update (update rather than refresh) the contents of the schema window. This way is more difficult than the first method, bad operation. Especially when the control in the pattern window involves data binding, it is much more difficult to operate.
The third method I did not operate successfully. General idea: Using the () method to open the B.aspx page, b.aspx page load, the a.aspx all the controls are disabled, but also to the A.aspx page refresh function off (shift+f10,f5, right button, The browser's own refresh button), when the B.aspx page is closed, pass a parameter to the a.aspx page until the parameter value is true, and then release all disabled resources. In practice, the open () method disables the refresh of the A.aspx page after opening the b.aspx page. Add opener.document.oncontextmenu= "return false" on Window.onload=funciton () {} of b.aspx page, not disabled right key
Opener.document.onkeydown=function () {if (event.keycode==116) Event.keycode=0;event.returnvalue=false} Calling the corresponding event also prohibits the F5 key.
It was also suspected that these events were written with a problem, directly put these events on a separate page to do the test, once to test the page, these are correct: the ban on the F5 and right key. Go back to open the B.aspx page with open (), not for disabled purposes. The back of the root is not going to go on, very frustrated ...
The first is a good second, and the second approach is to have some understanding of Ajax. As to which technology to choose, you need to look at the situation of the individual, which way to start quickly choose that method.
The third approach to the problem, do not know how to solve ....
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: 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.