In the IFRAME pop-up window, send data back to the parent page [call the js method of the parent page and simulate the send-back event of the call button]

Source: Internet
Author: User

There is now a parent page. The IFRAME embedded window (page B) appears when you click the button, for example:

The function we want to implement is to send the selected information from the pop-up window B to homepage a and process the information when you click OK.

 

First, define the following function for sending back on page:

<Script Type= "Text/JavaScript">

FunctionRebind (ID ){

_ Dopostback ('Ctl00 $ pagebody $ linkbutton1', ID );//Simulate the send-back event of the call button and input a value. Obtain the Client ID of the button.

Tb_remove ();//How to close the pop-up window

}

</Script>

< ASP : Linkbutton ID= "Linkbutton1" Runat= "Server" Onclick= "Linkbutton#click"> </ASP:Linkbutton>

In the background of page A, click the button to send back the event:

//Bound question name

Protected VoidLinkbutton#click (ObjectSender,EventargsE)

{

IntCdid =Int. Parse (request. Form ["_ Eventargument"]. Tostring ());// QuestionID, which is the parameter of the frontend sending back.

/* Processing Method */

}

 

Event triggered when you click OK on page B:

//OK

Protected VoidButton#click (ObjectSender,EventargsE)

{

StringId = hfepid. value;//Obtain the selectedIDValue

StringSTR ="Window. Parent. rebindpaper ('"+ ID +"');";//Call the parent page binding method

Scriptmanager. Registerstartupscript (This. Page,Type. GetType ("System. String"), STR, STR,True);

}

In addition, you can also use the ajaxpro control to call the server-side functions from the client. For details, see:

Http://www.cnblogs.com/shawker/archive/2011/01/13/1934560.html

 

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.